This repository has been archived by the owner on Jan 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
export-utility-to-targets-build-install.patch
65 lines (56 loc) · 2.74 KB
/
export-utility-to-targets-build-install.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 4ce5f86eddc0bf42a971db4509829036d5b17b92 Mon Sep 17 00:00:00 2001
From: Stefan Granitz <stefan.graenitz@gmail.com>
Date: Fri, 1 Feb 2019 13:08:09 +0000
Subject: [PATCH] [CMake] Add install targets for utilities to LLVM exports if
LLVM_INSTALL_UTILS=ON
Summary: D56606 was only appending target names to the `LLVM_EXPORTS`/`LLVM_EXPORTS_BUILDTREE_ONLY` properties. Targets showed up correctly in the build-tree `LLVMExports.cmake`, but they were missing in the installed one (as we found in https://bugs.llvm.org/show_bug.cgi?id=40443), because install did not register them explicitly.
Reviewers: mgorny, smeenai, beanz, gottesmm, dschuff, tstellar, serge-sans-paille
Reviewed By: smeenai
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D57383
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@352869 91177308-0d34-0410-b5e6-96231b3b80d8
---
cmake/modules/AddLLVM.cmake | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 39781bf34e24..607d6e682b49 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -911,18 +911,28 @@ macro(add_llvm_utility name)
add_llvm_executable(${name} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN})
set_target_properties(${name} PROPERTIES FOLDER "Utils")
- if( LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS )
- install (TARGETS ${name}
- RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
- COMPONENT ${name})
- if (NOT LLVM_ENABLE_IDE)
- add_llvm_install_targets(install-${name}
- DEPENDS ${name}
- COMPONENT ${name})
+ if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
+ if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
+ 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}
+ ${export_to_llvmexports}
+ RUNTIME DESTINATION ${LLVM_UTILS_INSTALL_DIR}
+ COMPONENT ${name})
+
+ if (NOT LLVM_ENABLE_IDE)
+ add_llvm_install_targets(install-${name}
+ DEPENDS ${name}
+ COMPONENT ${name})
+ endif()
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
+ elseif(LLVM_BUILD_UTILS)
+ set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
endif()
- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
- elseif( LLVM_BUILD_UTILS )
- set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS_BUILDTREE_ONLY ${name})
endif()
endmacro(add_llvm_utility name)