diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2014-02-23 06:27:04 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2014-02-23 06:27:04 +0000 |
commit | af2c1130eef5f4f1936a8163153c795950817e3d (patch) | |
tree | 98e9f0dbff11b50b5ea00569d88f7a1ab07530c1 /llvm/cmake/modules/LLVM-Config.cmake | |
parent | 3897651250853ebce7d4b64408aec2dabb955e35 (diff) | |
download | bcm5719-llvm-af2c1130eef5f4f1936a8163153c795950817e3d.tar.gz bcm5719-llvm-af2c1130eef5f4f1936a8163153c795950817e3d.zip |
Simplify linking to system libraries
The LLVMSupport library implementation consolidates all dependencies on
system libraries. Move the logic gathering system libraries out of
'cmake/modules/LLVM-Config.cmake' and into 'lib/Support/CMakeLists.txt'.
Use the target_link_libraries() command there to tell CMake about the
link dependencies of the LLVMSupport implementation. CMake will
automatically propagate this to all targets that link LLVMSupport
directly or indirectly.
We still need to build knowledge of system library dependencies into
'llvm-config'. Store the list of libraries needed in a property on
LLVMSupport and teach 'tools/llvm-config/CMakeLists.txt' to retrieve it
from there.
Drop all calls to 'link_system_libs' and 'get_system_libs' from our
CMake code. Replace their implementations with a warning that explains
the calls are no longer necessary. Also drop from 'LLVMConfig.cmake'
the HAVE_* and related variables that were published there only to allow
'get_system_libs' to run outside our build process.
Contributed by Brad King.
llvm-svn: 201969
Diffstat (limited to 'llvm/cmake/modules/LLVM-Config.cmake')
-rw-r--r-- | llvm/cmake/modules/LLVM-Config.cmake | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/llvm/cmake/modules/LLVM-Config.cmake b/llvm/cmake/modules/LLVM-Config.cmake index af720fcb214..451fc56c6bf 100644 --- a/llvm/cmake/modules/LLVM-Config.cmake +++ b/llvm/cmake/modules/LLVM-Config.cmake @@ -1,36 +1,12 @@ 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 shell32) - elseif( CMAKE_HOST_UNIX ) - if( HAVE_LIBRT ) - set(system_libs ${system_libs} rt) - endif() - if( HAVE_LIBDL ) - set(system_libs ${system_libs} ${CMAKE_DL_LIBS}) - endif() - if(LLVM_ENABLE_TERMINFO) - if(HAVE_TERMINFO) - set(system_libs ${system_libs} ${TERMINFO_LIBS}) - endif() - endif() - if( LLVM_ENABLE_THREADS AND HAVE_LIBPTHREAD ) - set(system_libs ${system_libs} pthread) - endif() - if ( LLVM_ENABLE_ZLIB AND HAVE_LIBZ ) - set(system_libs ${system_libs} z) - endif() - endif( MINGW ) - endif( NOT MSVC ) - set(${return_var} ${system_libs} PARENT_SCOPE) -endfunction(get_system_libs) + message(AUTHOR_WARNING "get_system_libs no longer needed") + set(${return_var} "" PARENT_SCOPE) +endfunction() function(link_system_libs target) - get_system_libs(llvm_system_libs) - target_link_libraries(${target} ${llvm_system_libs}) -endfunction(link_system_libs) + message(AUTHOR_WARNING "link_system_libs no longer needed") +endfunction() function(is_llvm_target_library library return_var) @@ -70,7 +46,6 @@ endfunction(explicit_llvm_config) # This is a variant intended for the final user: function(llvm_map_components_to_libraries OUT_VAR) explicit_map_components_to_libraries(result ${ARGN}) - get_system_libs(sys_result) set( ${OUT_VAR} ${result} ${sys_result} PARENT_SCOPE ) endfunction(llvm_map_components_to_libraries) |