summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2016-11-07 23:46:05 +0000
committerJustin Bogner <mail@justinbogner.com>2016-11-07 23:46:05 +0000
commitbddcf4b2eba87eb9a5513fc978f885895dd17591 (patch)
tree4d763fb71ae1a4c4385cd0a30b98ef4214dde62f /cmake
parent0e2326e6f960fefe412a58fc746dd6244d96ab04 (diff)
cmake: Support exports correctly with LLVM_DISTRIBUTION_COMPONENTS
We need to apply the same export logic in clang as in llvm for LLVM_DISTRIBUTION_COMPONENTS, or the clang exports will be invalid when we use this config. This makes using distribution components without setting LLVM_TOOLCHAIN_ONLY=On work correctly. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286181 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddClang.cmake14
1 files changed, 13 insertions, 1 deletions
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
index 88ee1f71ed..16c65f632b 100644
--- a/cmake/modules/AddClang.cmake
+++ b/cmake/modules/AddClang.cmake
@@ -89,9 +89,15 @@ macro(add_clang_library name)
target_link_libraries(${name} INTERFACE ${LLVM_COMMON_LIBS})
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "libclang")
+
+ if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+ NOT LLVM_DISTRIBUTION_COMPONENTS)
+ set(export_to_clangtargets EXPORT ClangTargets)
+ endif()
+
install(TARGETS ${name}
COMPONENT ${name}
- EXPORT ClangTargets
+ ${export_to_clangtargets}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
RUNTIME DESTINATION bin)
@@ -128,7 +134,13 @@ macro(add_clang_tool name)
add_clang_executable(${name} ${ARGN})
if (CLANG_BUILD_TOOLS)
+ if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
+ NOT LLVM_DISTRIBUTION_COMPONENTS)
+ set(export_to_clangtargets EXPORT ClangTargets)
+ endif()
+
install(TARGETS ${name}
+ ${export_to_clangtargets}
RUNTIME DESTINATION bin
COMPONENT ${name})