summaryrefslogtreecommitdiffstats
path: root/polly/CMakeLists.txt
diff options
context:
space:
mode:
authorMichael Kruse <llvm@meinersbur.de>2016-08-25 14:58:29 +0000
committerMichael Kruse <llvm@meinersbur.de>2016-08-25 14:58:29 +0000
commitb41b990e05797d1d69ea735bb168893974757422 (patch)
tree1bbce7741653c7dd506f4521c5ae115882728643 /polly/CMakeLists.txt
parent606b06a1564360725547d9ac7d315303c8703af7 (diff)
downloadbcm5719-llvm-b41b990e05797d1d69ea735bb168893974757422.tar.gz
bcm5719-llvm-b41b990e05797d1d69ea735bb168893974757422.zip
Query llvm-config to get system libs required for linking.
Remove the unused function get_system_libs. Instead, run 'llvm-config --system-libs' to determine which libraries are required in addition LLVM's for linking an executable. At the moment these are the unittests that link to gtest and transitively depend on these system libs. llvm-svn: 279743
Diffstat (limited to 'polly/CMakeLists.txt')
-rw-r--r--polly/CMakeLists.txt24
1 files changed, 5 insertions, 19 deletions
diff --git a/polly/CMakeLists.txt b/polly/CMakeLists.txt
index 6f0776463b7..3d245ba50c5 100644
--- a/polly/CMakeLists.txt
+++ b/polly/CMakeLists.txt
@@ -21,22 +21,10 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
include_directories(${LLVM_INSTALL_ROOT}/include/)
# Get the system librarys that will link into LLVM.
- function(get_system_libs return_var)
- # Returns in `return_var' a list of system libraries used by LLVM.
- if( NOT MSVC )
- if( MINGW )
- set(system_libs ${system_libs} imagehlp psapi)
- elseif( CMAKE_HOST_UNIX )
- if( HAVE_LIBDL )
- set(system_libs ${system_libs} ${CMAKE_DL_LIBS})
- endif()
- if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD )
- set(system_libs ${system_libs} pthread)
- endif()
- endif( MINGW )
- endif( NOT MSVC )
- set(${return_var} ${system_libs} PARENT_SCOPE)
- endfunction(get_system_libs)
+ execute_process(COMMAND "${LLVM_INSTALL_ROOT}/bin/llvm-config" --system-libs
+ OUTPUT_VARIABLE LLVM_SYSTEM_LIBS
+ OUTPUT_STRIP_TRAILING_WHITESPACE)
+ message(STATUS "System libs required by LLVM: ${LLVM_SYSTEM_LIBS}")
# Determine where LLVM stores its libraries.
execute_process(COMMAND "${LLVM_INSTALL_ROOT}/bin/llvm-config" --libdir
@@ -100,9 +88,7 @@ if (NOT DEFINED LLVM_MAIN_SRC_DIR)
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h)
add_library(gtest ${UNITTEST_DIR}/googletest/src/gtest-all.cc)
target_include_directories(gtest PUBLIC "${UNITTEST_DIR}/googletest/include" PRIVATE "${UNITTEST_DIR}/googletest")
- if( NOT MSVC )
- target_link_libraries(gtest pthread tinfo dl)
- endif ()
+ target_link_libraries(gtest ${LLVM_SYSTEM_LIBS})
add_library(gtest_main ${UNITTEST_DIR}/UnitTestMain/TestMain.cpp)
target_link_libraries(gtest_main gtest)
OpenPOWER on IntegriCloud