Blob Blame History Raw
diff -Naur a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
--- a/llvm/cmake/modules/AddLLVM.cmake	2020-08-20 16:24:59.000000000 +0000
+++ b/llvm/cmake/modules/AddLLVM.cmake	2020-09-15 07:09:05.411311520 +0000
@@ -760,7 +760,11 @@
       if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
           (in_llvm_libs AND "llvm-libraries" IN_LIST LLVM_DISTRIBUTION_COMPONENTS) OR
           NOT LLVM_DISTRIBUTION_COMPONENTS)
-        set(export_to_llvmexports EXPORT LLVMExports)
+        if (ARG_SHARED)
+          set(export_to_llvmexports EXPORT LLVMExports)
+        else()
+          set(export_to_llvmexports EXPORT LLVMStaticExports)
+        endif()
         set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
       endif()
 
diff -Naur a/llvm/cmake/modules/CMakeLists.txt b/llvm/cmake/modules/CMakeLists.txt
--- a/llvm/cmake/modules/CMakeLists.txt	2020-08-20 16:24:59.000000000 +0000
+++ b/llvm/cmake/modules/CMakeLists.txt	2020-09-15 07:09:05.411311520 +0000
@@ -79,6 +79,7 @@
 # source files are put in the same cmake directory.
 set(LLVM_CONFIG_EXPORTS_FILE "${LLVM_EXPORTS_FILE}")
 set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS};${LLVM_EXPORTS_BUILDTREE_ONLY}")
+set(LLVM_CONFIG_STATIC_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMStaticExports.cmake")
 set(llvm_config_include_buildtree_only_exports
 "include(\"${LLVM_BUILDTREEONLY_EXPORTS_FILE}\")")
 configure_file(
@@ -139,6 +140,8 @@
   if(llvm_has_exports)
     install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
             COMPONENT cmake-exports)
+    install(EXPORT LLVMStaticExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
+            COMPONENT cmake-exports)
   endif()
 
   install(FILES
diff -Naur a/llvm/cmake/modules/LLVMConfig.cmake.in b/llvm/cmake/modules/LLVMConfig.cmake.in
--- a/llvm/cmake/modules/LLVMConfig.cmake.in	2020-08-20 16:24:59.000000000 +0000
+++ b/llvm/cmake/modules/LLVMConfig.cmake.in	2020-09-15 07:09:05.411311520 +0000
@@ -103,6 +103,8 @@
   set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@")
   include("@LLVM_CONFIG_EXPORTS_FILE@")
   @llvm_config_include_buildtree_only_exports@
+
+  include("@LLVM_CONFIG_STATIC_EXPORTS_FILE@" OPTIONAL)
 endif()
 
 # By creating intrinsics_gen, omp_gen and acc_gen here, subprojects that depend