summaryrefslogtreecommitdiffstats
path: root/llvm/cmake/modules/AddLLVM.cmake
diff options
context:
space:
mode:
authorAndrew Wilkins <axwalk@gmail.com>2015-09-05 08:27:33 +0000
committerAndrew Wilkins <axwalk@gmail.com>2015-09-05 08:27:33 +0000
commitbb6d95fc3a74eab118b622e4c779d0b9edc53f54 (patch)
treec991238155de0d4d408287bf1efd7cfcaed7bd8b /llvm/cmake/modules/AddLLVM.cmake
parent6f73008506ec923ff69309016fd28cb6121eb11d (diff)
downloadbcm5719-llvm-bb6d95fc3a74eab118b622e4c779d0b9edc53f54.tar.gz
bcm5719-llvm-bb6d95fc3a74eab118b622e4c779d0b9edc53f54.zip
[cmake] rework LLVM_LINK_LLVM_DYLIB option handling
Summary: This diff attempts to address the concerns raised in http://reviews.llvm.org/D12488. We introduce a new USE_SHARED option to llvm_config, which, if set, causes the target to be linked against libLLVM. add_llvm_utility now uniformly disables linking against libLLVM. These utilities are not intended for distribution, and this keeps the option handling more centralised. llvm-shlib is now processes before any other "tools" subdirectories, ensuring the libLLVM target is defined before its dependents. One main difference from what was requested: llvm_config does not prune LLVM_DYLIB_COMPONENTS from the components passed into explicit_llvm_config. This is because the "all" component does something special, adding additional libraries (namely libLTO). Adding the component libraries after libLLVM should not be a problem, as symbols will be resolved in libLLVM first. Finally, I'm not really happy with the DISABLE_LLVM_LINK_LLVM option, but I'm not sure of a better way to get the following: - link all tools and shared libraries to libLLVM if LLVM_LINK_LLVM_DYLIB is set - some way of explicitly *not* doing so for utilities and libLLVM itself Suggestions for improvement here are particularly welcome. Reviewers: beanz Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D12590 llvm-svn: 246918
Diffstat (limited to 'llvm/cmake/modules/AddLLVM.cmake')
-rw-r--r--llvm/cmake/modules/AddLLVM.cmake12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index f53b89d32ab..0f3b660b95f 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -610,13 +610,13 @@ macro(add_llvm_executable name)
add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
endif(LLVM_EXPORTED_SYMBOL_FILE)
- set(EXCLUDE_FROM_ALL OFF)
- set_output_directory(${name} ${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR})
if (LLVM_LINK_LLVM_DYLIB AND NOT ARG_DISABLE_LLVM_LINK_LLVM_DYLIB)
- target_link_libraries(${name} LLVM)
- else()
- llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
+ set(USE_SHARED USE_SHARED)
endif()
+
+ set(EXCLUDE_FROM_ALL OFF)
+ set_output_directory(${name} ${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR})
+ llvm_config( ${name} ${USE_SHARED} ${LLVM_LINK_COMPONENTS} )
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
@@ -677,7 +677,7 @@ endmacro(add_llvm_example name)
macro(add_llvm_utility name)
- add_llvm_executable(${name} ${ARGN})
+ add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
set_target_properties(${name} PROPERTIES FOLDER "Utils")
if( LLVM_INSTALL_UTILS )
install (TARGETS ${name}
OpenPOWER on IntegriCloud