diff options
author | Oscar Fuentes <ofv@wanadoo.es> | 2009-05-27 15:49:33 +0000 |
---|---|---|
committer | Oscar Fuentes <ofv@wanadoo.es> | 2009-05-27 15:49:33 +0000 |
commit | 1a53cbfb4a532511633ad752fcf7396a79857e98 (patch) | |
tree | 38f7a3cad6ac8c3eed2a48fcc576a1406ba88295 /cmake | |
parent | b5da3f6f98b28afc0c62572c164ffccb4004827f (diff) | |
download | external_llvm-1a53cbfb4a532511633ad752fcf7396a79857e98.zip external_llvm-1a53cbfb4a532511633ad752fcf7396a79857e98.tar.gz external_llvm-1a53cbfb4a532511633ad752fcf7396a79857e98.tar.bz2 |
CMake: Set LIBS on llvm-config so we can query the system libraries
used by CMake with --ldflags.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72470 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rwxr-xr-x | cmake/modules/AddLLVM.cmake | 14 | ||||
-rwxr-xr-x | cmake/modules/LLVMConfig.cmake | 19 |
2 files changed, 23 insertions, 10 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 1f0ff74..c531298 100755 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -30,17 +30,11 @@ macro(add_llvm_executable name) target_link_libraries(${name} ${llvm_libs}) else( MSVC ) add_dependencies(${name} llvm-config.target) - if( MINGW ) - target_link_libraries(${name} imagehlp psapi) - elseif( CMAKE_HOST_UNIX ) - if( HAVE_LIBDL ) - target_link_libraries(${name} dl) - endif() - if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD ) - target_link_libraries(${name} pthread) - endif() - endif( MINGW ) endif( MSVC ) + get_system_libs(llvm_system_libs) + if( llvm_system_libs ) + target_link_libraries(${name} ${llvm_system_libs}) + endif() endmacro(add_llvm_executable name) diff --git a/cmake/modules/LLVMConfig.cmake b/cmake/modules/LLVMConfig.cmake index 63f9ded..9776fb0 100755 --- a/cmake/modules/LLVMConfig.cmake +++ b/cmake/modules/LLVMConfig.cmake @@ -1,5 +1,24 @@ include(FindPerl) + +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} dl) + 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) + + macro(llvm_config executable) # extra args is the list of link components. if( MSVC ) |