summaryrefslogtreecommitdiffstats
path: root/recipes-devtools/clang/clang/0021-clang-llvm-cmake-Fix-configure-for-packages-using-fi.patch
blob: 09bc9d8550cd40e8710adec6a30b4447068c2add (plain)
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
From f48b53ec65d4138139339f4d1cdc12c4e1a1c042 Mon Sep 17 00:00:00 2001
From: Ovidiu Panait <ovidiu.panait@windriver.com>
Date: Fri, 31 Jan 2020 10:56:11 +0200
Subject: [PATCH 21/24] clang,llvm: cmake: Fix configure for packages using
 find_package()

Currently, when a package (i.e. bcc [https://github.com/iovisor/bcc.git])
that depends on LLVM/Clang tries to run cmake find_package() during
do_configure, it will fail with a similar error:

|   The imported target "llvm-tblgen" references the file
|      ".../recipe-sysroot/usr/bin/llvm-tblgen"
|
|   but this file does not exist.  Possible reasons include:
|   * The file was deleted, renamed, or moved to another location.
|   * An install or uninstall procedure did not complete successfully.
|   * The installation package was faulty and contained
|      ".../recipe-sysroot/usr/lib/cmake/LLVMExports.cmake"
|   but not all the files it references.

This is due to the fact that currently the cmake scripts look for target
binaries in sysroot. Work around this by not exporting the target binaries in
Exports-* cmake files.

Upstream-Status: Innapropriate [oe-specific]

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
---
 clang/cmake/modules/AddClang.cmake |  8 --------
 llvm/cmake/modules/AddLLVM.cmake   | 18 ------------------
 llvm/cmake/modules/TableGen.cmake  |  7 -------
 3 files changed, 33 deletions(-)

diff --git a/clang/cmake/modules/AddClang.cmake b/clang/cmake/modules/AddClang.cmake
index 704278a0e93..6ea99c90772 100644
--- a/clang/cmake/modules/AddClang.cmake
+++ b/clang/cmake/modules/AddClang.cmake
@@ -161,15 +161,8 @@ macro(add_clang_tool name)
   add_dependencies(${name} clang-resource-headers)
 
   if (CLANG_BUILD_TOOLS)
-    set(export_to_clangtargets)
-    if(${name} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-        NOT LLVM_DISTRIBUTION_COMPONENTS)
-      set(export_to_clangtargets EXPORT ClangTargets)
-      set_property(GLOBAL PROPERTY CLANG_HAS_EXPORTS True)
-    endif()
 
     install(TARGETS ${name}
-      ${export_to_clangtargets}
       RUNTIME DESTINATION bin
       COMPONENT ${name})
 
@@ -178,7 +171,6 @@ macro(add_clang_tool name)
                                DEPENDS ${name}
                                COMPONENT ${name})
     endif()
-    set_property(GLOBAL APPEND PROPERTY CLANG_EXPORTS ${name})
   endif()
 endmacro()
 
diff --git a/llvm/cmake/modules/AddLLVM.cmake b/llvm/cmake/modules/AddLLVM.cmake
index 333167bfb6b..f00fd98bdb2 100644
--- a/llvm/cmake/modules/AddLLVM.cmake
+++ b/llvm/cmake/modules/AddLLVM.cmake
@@ -1169,15 +1169,8 @@ macro(add_llvm_tool name)
 
   if ( ${name} IN_LIST LLVM_TOOLCHAIN_TOOLS OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
     if( LLVM_BUILD_TOOLS )
-      set(export_to_llvmexports)
-      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_TOOLS_INSTALL_DIR}
               COMPONENT ${name})
 
@@ -1188,9 +1181,6 @@ macro(add_llvm_tool name)
       endif()
     endif()
   endif()
-  if( LLVM_BUILD_TOOLS )
-    set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${name})
-  endif()
   set_target_properties(${name} PROPERTIES FOLDER "Tools")
 endmacro(add_llvm_tool name)
 
@@ -1228,15 +1218,8 @@ macro(add_llvm_utility name)
   set_target_properties(${name} PROPERTIES FOLDER "Utils")
   if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
     if (LLVM_INSTALL_UTILS AND LLVM_BUILD_UTILS)
-      set(export_to_llvmexports)
-      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})
 
@@ -1245,7 +1228,6 @@ macro(add_llvm_utility 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()
diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
index 73c1e96d3d9..7b1c33961c1 100644
--- a/llvm/cmake/modules/TableGen.cmake
+++ b/llvm/cmake/modules/TableGen.cmake
@@ -183,14 +183,8 @@ macro(add_tablegen target project)
   endif()
 
   if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS)
-    set(export_to_llvmexports)
-    if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR
-        NOT LLVM_DISTRIBUTION_COMPONENTS)
-      set(export_to_llvmexports EXPORT LLVMExports)
-    endif()
 
     install(TARGETS ${target}
-            ${export_to_llvmexports}
             COMPONENT ${target}
             RUNTIME DESTINATION ${LLVM_TOOLS_INSTALL_DIR})
     if(NOT LLVM_ENABLE_IDE)
@@ -199,5 +193,4 @@ macro(add_tablegen target project)
                                COMPONENT ${target})
     endif()
   endif()
-  set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS ${target})
 endmacro()
-- 
2.27.0