Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions ports/llvm-12/0020-fix-FindZ3.cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
diff --git a/llvm/cmake/modules/FindZ3.cmake b/llvm/cmake/modules/FindZ3.cmake
index 118b1eac3b32..455bbf28facc 100644
--- a/llvm/cmake/modules/FindZ3.cmake
+++ b/llvm/cmake/modules/FindZ3.cmake
@@ -1,3 +1,22 @@
+# Try first to find Z3 using its upstream cmake files (included in newer version)
+# unless the user has provided a hint that would assume skipping the CONFIG
+# option
+if (NOT DEFINED Z3_ROOT AND NOT LLVM_Z3_INSTALL_DIR)
+ find_package(Z3 QUIET CONFIG)
+endif()
+
+# If we found with CONFIG mode, then set up the compatible variables
+if (Z3_FOUND)
+ set(Z3_VERSION "${Z3_VERSION_STRING}")
+ set(Z3_LIBRARIES z3::libz3)
+ get_property(Z3_INCLUDE_DIR
+ TARGET z3::libz3 PROPERTY
+ INTERFACE_INCLUDE_DIRECTORIES
+ )
+ find_package_handle_standard_args(Z3 CONFIG_MODE)
+
+else()
+
INCLUDE(CheckCXXSourceRuns)

# Function to check Z3's version
@@ -123,3 +142,5 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3
VERSION_VAR Z3_VERSION_STRING)

mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES)
+
+endif()
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index cdee11412eb5..9a229e903ba5 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -46,7 +46,11 @@ endif()

# Link Z3 if the user wants to build it.
if(LLVM_WITH_Z3)
- set(system_libs ${system_libs} ${Z3_LIBRARIES})
+ if(TARGET "${Z3_LIBRARIES}")
+ set(imported_libs ${imported_libs} "${Z3_LIBRARIES}")
+ else()
+ set(system_libs ${system_libs} ${Z3_LIBRARIES})
+ endif()
endif()

# Override the C runtime allocator on Windows and embed it into LLVM tools & libraries
@@ -248,6 +252,19 @@ if(LLVM_ENABLE_ZLIB)
set(llvm_system_libs ${llvm_system_libs} "${zlib_library}")
endif()

+if(LLVM_WITH_Z3 AND TARGET "${Z3_LIBRARIES}")
+ # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators.
+ if(CMAKE_BUILD_TYPE)
+ string(TOUPPER ${CMAKE_BUILD_TYPE} build_type)
+ get_property(z3_library TARGET "${Z3_LIBRARIES}" PROPERTY LOCATION_${build_type})
+ endif()
+ if(NOT z3_library)
+ get_property(z3_library TARGET "${Z3_LIBRARIES}" PROPERTY LOCATION)
+ endif()
+ get_library_name("${z3_library}" z3_library)
+ set(llvm_system_libs ${llvm_system_libs} "${z3_library}")
+endif()
+
if(LLVM_ENABLE_TERMINFO)
get_library_name(${TERMINFO_LIB} terminfo_library)
set(llvm_system_libs ${llvm_system_libs} "${terminfo_library}")
116 changes: 0 additions & 116 deletions ports/llvm-12/0020-remove-FindZ3.cmake.patch

This file was deleted.

151 changes: 0 additions & 151 deletions ports/llvm-12/0021-fix-FindZ3.cmake.patch

This file was deleted.

3 changes: 1 addition & 2 deletions ports/llvm-12/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ vcpkg_from_github(
0009-fix-tools-install-path.patch
0010-fix-libffi.patch
0011-fix-libxml2.patch
0020-remove-FindZ3.cmake.patch
0021-fix-FindZ3.cmake.patch
0020-fix-FindZ3.cmake.patch
0022-llvm-config-bin-path.patch
0023-clang-sys-include-dir-path.patch
)
Expand Down
Loading