1 Star 0 Fork 60

zhangbo / llvm

forked from src-openEuler / llvm 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CMake-Split-static-library-exports-into-their-own-ex.patch 3.29 KB
一键复制 编辑 原始数据 按行查看 历史
zhangtao2020 提交于 2020-03-18 17:18 . add four patches
From f9e66a883e1fb748e6ac826fde188efaae249361 Mon Sep 17 00:00:00 2001
From: Tom Stellard <tstellar@redhat.com>
Date: Sat, 29 Apr 2017 02:03:23 +0000
Subject: [PATCH] CMake: Split static library exports into their own export
file
Summary:
This is to better support distros which split the static libraries into
their own package.
The current problem is that any project the includes LLVMConfig.cmake
will fail to configure unless the static libraries are installed. This
is because LLVMConfig.cmake includes LLVMExports.cmake, which throws an
error if it can't find files linked to one of the exported targets.
This patch resolves the problem by putting the static library targets
into their own export file, LLVMStaticExports.cmake. This file
is optionally included by LLVMConfig.cmake, so distros can put this
new file in their static library package to make LLVMConfig.cmake
no longer depend on these libraries when they are not installed.
Reviewers: beanz, mgorny, chapuni
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D32668
---
cmake/modules/AddLLVM.cmake | 6 +++++-
cmake/modules/CMakeLists.txt | 3 +++
cmake/modules/LLVMConfig.cmake.in | 2 ++
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index fd5627e..78f106f 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -635,7 +635,11 @@ macro(add_llvm_library name)
if(${name} 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 --git a/cmake/modules/CMakeLists.txt b/cmake/modules/CMakeLists.txt
index 6074e83..e9fcb11 100644
--- a/cmake/modules/CMakeLists.txt
+++ b/cmake/modules/CMakeLists.txt
@@ -91,6 +91,7 @@ set(LLVM_CONFIG_BINARY_DIR "\${LLVM_INSTALL_PREFIX}")
set(LLVM_CONFIG_TOOLS_BINARY_DIR "\${LLVM_INSTALL_PREFIX}/bin")
set(LLVM_CONFIG_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMExports.cmake")
set(LLVM_CONFIG_EXPORTS "${LLVM_EXPORTS}")
+set(LLVM_CONFIG_STATIC_EXPORTS_FILE "\${LLVM_CMAKE_DIR}/LLVMStaticExports.cmake")
configure_file(
LLVMConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/LLVMConfig.cmake
@@ -107,6 +108,8 @@ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
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 --git a/cmake/modules/LLVMConfig.cmake.in b/cmake/modules/LLVMConfig.cmake.in
index 0772016..f471625 100644
--- a/cmake/modules/LLVMConfig.cmake.in
+++ b/cmake/modules/LLVMConfig.cmake.in
@@ -78,6 +78,8 @@ if(NOT TARGET LLVMSupport)
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 here, subprojects that depend on LLVM's
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangbo20/llvm.git
git@gitee.com:zhangbo20/llvm.git
zhangbo20
llvm
llvm
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891