summaryrefslogtreecommitdiff
blob: 3e39a9eda5002e74a468b6d11c06f3f58c0a84d2 (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
From: Matthias Maier <tamiko@43-1.org>
Date: Sat, 11 Jun 2022 01:44:54 -0500
Subject: [PATCH] Fix cmake configure for shared LLVM libraries

Gentoo builds LLVM into a combined shared library. The CMake
configuration shipped with LLVM is evidently broken in this case, see

  https://github.com/llvm/llvm-project/issues/34593
  https://bugs.gentoo.org/745915

We work around this issue by simply linking against the monolithic
"LLVM" target.
---
 CMakeLists.txt | 23 +----------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cf5ab3b..dfa6605 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -402,28 +402,7 @@ if (WITH_LLVM)
     endforeach()
     set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG")
 
-    llvm_map_components_to_libnames(llvm_libs_direct ${SYMENGINE_LLVM_COMPONENTS})
-    llvm_expand_dependencies(llvm_libs ${llvm_libs_direct})
-
-    if (BUILD_SHARED_LIBS)
-        set(SYMENGINE_LLVM_LINK_DOWNSTREAM_DEFAULT False)
-        foreach(LLVM_LIB ${llvm_libs})
-            get_target_property(${LLVM_LIB}_IMPORT_LOCATION ${LLVM_LIB} LOCATION)
-            if (NOT "${${LLVM_LIB}_IMPORT_LOCATION}" MATCHES "NOTFOUND")
-                if (NOT "${${LLVM_LIB}_IMPORT_LOCATION}" MATCHES ".a$|.lib$")
-                    set(SYMENGINE_LLVM_LINK_DOWNSTREAM_DEFAULT True)
-                endif()
-            endif()
-        endforeach()
-    else()
-        set(SYMENGINE_LLVM_LINK_DOWNSTREAM_DEFAULT True)
-    endif()
-    set(SYMENGINE_LLVM_LINK_DOWNSTREAM ${SYMENGINE_LLVM_LINK_DOWNSTREAM_DEFAULT}
-        CACHE INTERNAL "Link to llvm in SymEngineConfig.cmake")
-    if (NOT SYMENGINE_LLVM_LINK_DOWNSTREAM)
-        unset(SYMENGINE_LLVM_COMPONENTS)
-    endif ()
-    set(LIBS ${LIBS} ${llvm_libs})
+    set(LIBS ${LIBS} LLVM)
     include_directories(SYSTEM ${LLVM_INCLUDE_DIRS})
     set(HAVE_SYMENGINE_LLVM yes)
     set(PKGS ${PKGS} "LLVM")
-- 
2.35.1