|
|
a264db5 |
From f9e66a883e1fb748e6ac826fde188efaae249361 Mon Sep 17 00:00:00 2001
|
|
|
4b6a509 |
From: Tom Stellard <tstellar@redhat.com>
|
|
|
4b6a509 |
Date: Sat, 29 Apr 2017 02:03:23 +0000
|
|
|
4b6a509 |
Subject: [PATCH] CMake: Split static library exports into their own export
|
|
|
4b6a509 |
file
|
|
|
4b6a509 |
|
|
|
4b6a509 |
Summary:
|
|
|
4b6a509 |
This is to better support distros which split the static libraries into
|
|
|
4b6a509 |
their own package.
|
|
|
4b6a509 |
|
|
|
4b6a509 |
The current problem is that any project the includes LLVMConfig.cmake
|
|
|
4b6a509 |
will fail to configure unless the static libraries are installed. This
|
|
|
4b6a509 |
is because LLVMConfig.cmake includes LLVMExports.cmake, which throws an
|
|
|
4b6a509 |
error if it can't find files linked to one of the exported targets.
|
|
|
4b6a509 |
|
|
|
4b6a509 |
This patch resolves the problem by putting the static library targets
|
|
|
4b6a509 |
into their own export file, LLVMStaticExports.cmake. This file
|
|
|
4b6a509 |
is optionally included by LLVMConfig.cmake, so distros can put this
|
|
|
4b6a509 |
new file in their static library package to make LLVMConfig.cmake
|
|
|
4b6a509 |
no longer depend on these libraries when they are not installed.
|
|
|
4b6a509 |
|
|
|
4b6a509 |
Reviewers: beanz, mgorny, chapuni
|
|
|
4b6a509 |
|
|
|
4b6a509 |
Subscribers: llvm-commits
|
|
|
4b6a509 |
|
|
|
4b6a509 |
Differential Revision: https://reviews.llvm.org/D32668
|
|
|
4b6a509 |
---
|
|
|
4b6a509 |
cmake/modules/AddLLVM.cmake | 6 +++++-
|
|
|
4b6a509 |
cmake/modules/CMakeLists.txt | 3 +++
|
|
|
4b6a509 |
cmake/modules/LLVMConfig.cmake.in | 2 ++
|
|
|
4b6a509 |
3 files changed, 10 insertions(+), 1 deletion(-)
|
|
|
4b6a509 |
|
|
|
4b6a509 |
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
|
|
|
a264db5 |
index fd5627e..78f106f 100644
|
|
|
4b6a509 |
--- a/cmake/modules/AddLLVM.cmake
|
|
|
4b6a509 |
+++ b/cmake/modules/AddLLVM.cmake
|
|
|
a264db5 |
@@ -635,7 +635,11 @@ macro(add_llvm_library name)
|
|
|
4b6a509 |
|
|
|
4b6a509 |
if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
|
|
|
4b6a509 |
NOT LLVM_DISTRIBUTION_COMPONENTS)
|
|
|
4b6a509 |
- set(export_to_llvmexports EXPORT LLVMExports)
|
|
|
4b6a509 |
+ if (ARG_SHARED)
|
|
|
4b6a509 |
+ set(export_to_llvmexports EXPORT LLVMExports)
|
|
|
4b6a509 |
+ else()
|
|
|
4b6a509 |
+ set(export_to_llvmexports EXPORT LLVMStaticExports)
|
|
|
4b6a509 |
+ endif()
|
|
|
4b6a509 |
set_property(GLOBAL PROPERTY LLVM_HAS_EXPORTS True)
|
|
|
4b6a509 |
endif()
|
|
|
4b6a509 |
|
|
|
4b6a509 |
diff --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
|
|
|
a264db5 |
index 6074e83..e9fcb11 100644
|
|
|
4b6a509 |
--- a/cmake/modules/CMakeLists.txt
|
|
|
4b6a509 |
+++ b/cmake/modules/CMakeLists.txt
|
|
|
4b6a509 |
@@ -91,6 +91,7 @@ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
|
|
|
4b6a509 |
set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
|
|
|
4b6a509 |
set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
|
|
|
4b6a509 |
set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
|
|
|
4b6a509 |
+set(LLVM_CONFIG_STATIC_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMStaticExports.cmake")
|
|
|
4b6a509 |
configure_file(
|
|
|
4b6a509 |
LLVMConfig.cmake.in
|
|
|
4b6a509 |
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
|
|
|
4b6a509 |
@@ -107,6 +108,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
|
|
|
4b6a509 |
if(llvm_has_exports)
|
|
|
4b6a509 |
install(EXPORT LLVMExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
|
|
|
4b6a509 |
COMPONENT cmake-exports)
|
|
|
4b6a509 |
+ install(EXPORT LLVMStaticExports DESTINATION ${LLVM_INSTALL_PACKAGE_DIR}
|
|
|
4b6a509 |
+ COMPONENT cmake-exports)
|
|
|
4b6a509 |
endif()
|
|
|
4b6a509 |
|
|
|
4b6a509 |
install(FILES
|
|
|
4b6a509 |
diff --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in
|
|
|
a264db5 |
index 0772016..f471625 100644
|
|
|
4b6a509 |
--- a/cmake/modules/LLVMConfig.cmake.in
|
|
|
4b6a509 |
+++ b/cmake/modules/LLVMConfig.cmake.in
|
|
|
a264db5 |
@@ -78,6 +78,8 @@ if(NOT TARGET LLVMSupport)
|
|
|
4b6a509 |
set(LLVM_EXPORTED_TARGETS "@LLVM_CONFIG_EXPORTS@")
|
|
|
4b6a509 |
include("@LLVM_CONFIG_EXPORTS_FILE@")
|
|
|
4b6a509 |
@llvm_config_include_buildtree_only_exports@
|
|
|
4b6a509 |
+
|
|
|
4b6a509 |
+ include("@LLVM_CONFIG_STATIC_EXPORTS_FILE@" OPTIONAL)
|
|
|
4b6a509 |
endif()
|
|
|
4b6a509 |
|
|
|
a264db5 |
# By creating intrinsics_gen here, subprojects that depend on LLVM's
|
|
|
4b6a509 |
--
|
|
|
3d29fda |
1.8.3.1
|
|
|
4b6a509 |
|