From adbd909be70e7310a5bb88fb57a6d0babb70409a Mon Sep 17 00:00:00 2001 From: Justin Bogner Date: Tue, 8 Nov 2016 05:02:18 +0000 Subject: [PATCH] cmake: Don't try to install exports if there aren't any When using LLVM_DISTRIBUTION_COMPONENTS, it's possible for LLVM'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/llvm/trunk@286209 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/modules/AddLLVM.cmake | 3 +++ cmake/modules/CMakeLists.txt | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 11fa225ebf8..e8e119b2ad2 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -587,6 +587,7 @@ macro(add_llvm_library name) if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR NOT LLVM_DISTRIBUTION_COMPONENTS) set(export_to_llvmexports EXPORT LLVMExports) + set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) endif() install(TARGETS ${name} @@ -627,6 +628,7 @@ macro(add_llvm_loadable_module name) if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR NOT LLVM_DISTRIBUTION_COMPONENTS) set(export_to_llvmexports EXPORT LLVMExports) + set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) endif() install(TARGETS ${name} @@ -811,6 +813,7 @@ macro(add_llvm_tool name) if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR NOT LLVM_DISTRIBUTION_COMPONENTS) set(export_to_llvmexports EXPORT LLVMExports) + set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True) endif() install(TARGETS ${name} diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt index 080c30e0db8..ac4b0b7c030 100644 --- a/cmake/modules/CMakeLists.txt +++ b/cmake/modules/CMakeLists.txt @@ -103,8 +103,11 @@ configure_file( @ONLY) if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) - install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} - COMPONENT cmake-exports) + get_property(llvm_has_exports GLOBAL PROPERTY LLVM_HAS_EXPORTS) + if(llvm_has_exports) + install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR} + COMPONENT cmake-exports) + endif() install(FILES ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake -- 2.40.0