]> granicus.if.org Git - llvm/commitdiff
cmake: Don't try to install exports if there aren't any
authorJustin Bogner <mail@justinbogner.com>
Tue, 8 Nov 2016 05:02:18 +0000 (05:02 +0000)
committerJustin Bogner <mail@justinbogner.com>
Tue, 8 Nov 2016 05:02:18 +0000 (05:02 +0000)
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
cmake/modules/CMakeLists.txt

index 11fa225ebf8a09780c4bc35c4fb59e23808d3f49..e8e119b2ad2fca9c8d7f595cbdfbe034064b6acb 100644 (file)
@@ -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}
index 080c30e0db895ac365c1673b7e137e96cd58087a..ac4b0b7c03047804539479f74261b6be75de4dc3 100644 (file)
@@ -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