Add CMake check for libatomic.
[oota-llvm.git] / lib / Support / CMakeLists.txt
1 add_llvm_library(LLVMSupport
2   APFloat.cpp
3   APInt.cpp
4   APSInt.cpp
5   ARMBuildAttrs.cpp
6   ARMWinEH.cpp
7   Allocator.cpp
8   BlockFrequency.cpp
9   BranchProbability.cpp
10   circular_raw_ostream.cpp
11   CommandLine.cpp
12   Compression.cpp
13   ConvertUTF.c
14   ConvertUTFWrapper.cpp
15   CrashRecoveryContext.cpp
16   DataExtractor.cpp
17   DataStream.cpp
18   Debug.cpp
19   DeltaAlgorithm.cpp
20   DAGDeltaAlgorithm.cpp
21   Dwarf.cpp
22   ErrorHandling.cpp
23   FileUtilities.cpp
24   FileOutputBuffer.cpp
25   FoldingSet.cpp
26   FormattedStream.cpp
27   GraphWriter.cpp
28   Hashing.cpp
29   IntEqClasses.cpp
30   IntervalMap.cpp
31   IntrusiveRefCntPtr.cpp
32   IsInf.cpp
33   IsNAN.cpp
34   LEB128.cpp
35   LineIterator.cpp
36   Locale.cpp
37   LockFileManager.cpp
38   ManagedStatic.cpp
39   MemoryBuffer.cpp
40   MemoryObject.cpp
41   MD5.cpp
42   PluginLoader.cpp
43   PrettyStackTrace.cpp
44   RandomNumberGenerator.cpp
45   Regex.cpp
46   ScaledNumber.cpp
47   SmallPtrSet.cpp
48   SmallVector.cpp
49   SourceMgr.cpp
50   SpecialCaseList.cpp
51   Statistic.cpp
52   StreamableMemoryObject.cpp
53   StringExtras.cpp
54   StringMap.cpp
55   StringPool.cpp
56   StringRef.cpp
57   StringRefMemoryObject.cpp
58   SystemUtils.cpp
59   Timer.cpp
60   ToolOutputFile.cpp
61   Triple.cpp
62   Twine.cpp
63   Unicode.cpp
64   YAMLParser.cpp
65   YAMLTraits.cpp
66   raw_os_ostream.cpp
67   raw_ostream.cpp
68   regcomp.c
69   regerror.c
70   regexec.c
71   regfree.c
72   regstrlcpy.c
73
74 # System
75   Atomic.cpp
76   DynamicLibrary.cpp
77   Errno.cpp
78   Host.cpp
79   Memory.cpp
80   Mutex.cpp
81   Path.cpp
82   Process.cpp
83   Program.cpp
84   RWMutex.cpp
85   SearchForAddressOfSpecialSymbol.cpp
86   Signals.cpp
87   TargetRegistry.cpp
88   ThreadLocal.cpp
89   Threading.cpp
90   TimeValue.cpp
91   Valgrind.cpp
92   Watchdog.cpp
93
94   ADDITIONAL_HEADERS
95   Unix/Host.inc
96   Unix/Memory.inc
97   Unix/Mutex.inc
98   Unix/Path.inc
99   Unix/Process.inc
100   Unix/Program.inc
101   Unix/RWMutex.inc
102   Unix/Signals.inc
103   Unix/ThreadLocal.inc
104   Unix/TimeValue.inc
105   Unix/Watchdog.inc
106   Windows/DynamicLibrary.inc
107   Windows/Host.inc
108   Windows/Memory.inc
109   Windows/Mutex.inc
110   Windows/Path.inc
111   Windows/Process.inc
112   Windows/Program.inc
113   Windows/RWMutex.inc
114   Windows/Signals.inc
115   Windows/ThreadLocal.inc
116   Windows/TimeValue.inc
117   Windows/Watchdog.inc
118   )
119 set(system_libs)
120 if( NOT MSVC )
121   if( MINGW )
122     set(system_libs ${system_libs} imagehlp psapi shell32)
123   elseif( CMAKE_HOST_UNIX )
124     if( HAVE_LIBRT )
125       set(system_libs ${system_libs} rt)
126     endif()
127     if( HAVE_LIBDL )
128       set(system_libs ${system_libs} ${CMAKE_DL_LIBS})
129     endif()
130     if(LLVM_ENABLE_TERMINFO)
131       if(HAVE_TERMINFO)
132         set(system_libs ${system_libs} ${TERMINFO_LIBS})
133       endif()
134     endif()
135     if( LLVM_ENABLE_THREADS AND HAVE_LIBATOMIC )
136       set(system_libs ${system_libs} atomic)
137     endif()
138     if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
139       set(system_libs ${system_libs} pthread)
140     endif()
141     if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
142       set(system_libs ${system_libs} z)
143     endif()
144   endif( MINGW )
145 endif( NOT MSVC )
146
147
148 if(POLICY CMP0022 AND BUILD_SHARED_LIBS)
149   # FIXME: Should this be really PUBLIC?
150   target_link_libraries(LLVMSupport PUBLIC ${system_libs})
151 else()
152   target_link_libraries(LLVMSupport ${cmake_2_8_12_INTERFACE} ${system_libs})
153 endif()
154
155 set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${system_libs}")