llvm.org GIT mirror llvm / 93f761e
[CMake] LLVMSupport: Give system_libs PRIVATE scope when LLVMSupport is built as SHARED. Users of LLVMSupport won't inherit ${system_libs}. unittests/SupporTests is another user of libpthreads. Apply LLVM_SYSTEM_LIBS for him explicitly. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221531 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 4 years ago
2 changed file(s) with 36 addition(s) and 36 deletion(s). Raw diff Collapse all Expand all
0 set(system_libs)
1 if( NOT MSVC )
2 if( MINGW )
3 set(system_libs ${system_libs} imagehlp psapi shell32)
4 elseif( CMAKE_HOST_UNIX )
5 if( HAVE_LIBRT )
6 set(system_libs ${system_libs} rt)
7 endif()
8 if( HAVE_LIBDL )
9 set(system_libs ${system_libs} ${CMAKE_DL_LIBS})
10 endif()
11 if(LLVM_ENABLE_TERMINFO)
12 if(HAVE_TERMINFO)
13 set(system_libs ${system_libs} ${TERMINFO_LIBS})
14 endif()
15 endif()
16 if( LLVM_ENABLE_THREADS AND HAVE_LIBATOMIC )
17 set(system_libs ${system_libs} atomic)
18 endif()
19 if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
20 set(system_libs ${system_libs} pthread)
21 endif()
22 if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
23 set(system_libs ${system_libs} z)
24 endif()
25 set(system_libs ${system_libs} m)
26 endif( MINGW )
27 endif( NOT MSVC )
28
29 add_llvm_library(LLVMSupport
130 APFloat.cpp
231 APInt.cpp
116145 Windows/ThreadLocal.inc
117146 Windows/TimeValue.inc
118147 Windows/Watchdog.inc
148
149 LINK_LIBS ${system_libs}
119150 )
120 set(system_libs)
121 if( NOT MSVC )
122 if( MINGW )
123 set(system_libs ${system_libs} imagehlp psapi shell32)
124 elseif( CMAKE_HOST_UNIX )
125 if( HAVE_LIBRT )
126 set(system_libs ${system_libs} rt)
127 endif()
128 if( HAVE_LIBDL )
129 set(system_libs ${system_libs} ${CMAKE_DL_LIBS})
130 endif()
131 if(LLVM_ENABLE_TERMINFO)
132 if(HAVE_TERMINFO)
133 set(system_libs ${system_libs} ${TERMINFO_LIBS})
134 endif()
135 endif()
136 if( LLVM_ENABLE_THREADS AND HAVE_LIBATOMIC )
137 set(system_libs ${system_libs} atomic)
138 endif()
139 if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
140 set(system_libs ${system_libs} pthread)
141 endif()
142 if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ )
143 set(system_libs ${system_libs} z)
144 endif()
145 set(system_libs ${system_libs} m)
146 endif( MINGW )
147 endif( NOT MSVC )
148
149
150 if(POLICY CMP0022 AND BUILD_SHARED_LIBS)
151 # FIXME: Should this be really PUBLIC?
152 target_link_libraries(LLVMSupport PUBLIC ${system_libs})
153 else()
154 target_link_libraries(LLVMSupport ${cmake_2_8_12_INTERFACE} ${system_libs})
155 endif()
156151
157152 set_property(TARGET LLVMSupport PROPERTY LLVM_SYSTEM_LIBS "${system_libs}")
4141 formatted_raw_ostream_test.cpp
4242 raw_ostream_test.cpp
4343 )
44
45 # ManagedStatic.cpp uses .
46 if(LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD)
47 target_link_libraries(SupportTests pthread)
48 endif()