summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorJustin Bogner <mail@justinbogner.com>2016-11-08 05:02:33 +0000
committerJustin Bogner <mail@justinbogner.com>2016-11-08 05:02:33 +0000
commitd4a11674c514835fa7c9d75506b9886a5d891c41 (patch)
tree6ea8494870d9293a39ed38a9bc7e5f3db46e92ff /cmake
parentcf26f429e818a308251ca9a54b88394e98642ccd (diff)
cmake: Don't try to install exports if there aren't any
When using LLVM_DISTRIBUTION_COMPONENTS, it's possible for clang's export list to be empty. If this happens the install(EXPORTS) command will fail, but since there isn't anything to install anyway we really just want to skip it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@286210 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddClang.cmake2
-rw-r--r--cmake/modules/CMakeLists.txt5
2 files changed, 6 insertions, 1 deletions
diff --git a/cmake/modules/AddClang.cmake b/cmake/modules/AddClang.cmake
index 16c65f632b..e657059744 100644
--- a/cmake/modules/AddClang.cmake
+++ b/cmake/modules/AddClang.cmake
@@ -93,6 +93,7 @@ macro(add_clang_library name)
if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
NOT LLVM_DISTRIBUTION_COMPONENTS)
set(export_to_clangtargets EXPORT ClangTargets)
+ set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
endif()
install(TARGETS ${name}
@@ -137,6 +138,7 @@ macro(add_clang_tool name)
if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
NOT LLVM_DISTRIBUTION_COMPONENTS)
set(export_to_clangtargets EXPORT ClangTargets)
+ set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
endif()
install(TARGETS ${name}
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index 3cc808a46b..b784c0d215 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -39,7 +39,10 @@ set(CLANG_CONFIG_CMAKE_DIR)
set(CLANG_CONFIG_EXPORTS_FILE)
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
- install(EXPORT ClangTargets DESTINATION ${CLANG_INSTALL_PACKAGE_DIR})
+ get_property(clang_has_exports GLOBAL PROPERTY CLANG_HAS_EXPORTS)
+ if(clang_has_exports)
+ install(EXPORT ClangTargets DESTINATION ${CLANG_INSTALL_PACKAGE_DIR})
+ endif()
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/ClangConfig.cmake