[PATCH] D132441: Fix FindZ3.cmake's version detection mechanism
Zhang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 23 01:14:36 PDT 2022
Naville updated this revision to Diff 454733.
Naville added a comment.
Obviously ``{1,2}`` is not supported in CMake, updated to use ``+``
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132441/new/
https://reviews.llvm.org/D132441
Files:
llvm/cmake/modules/FindZ3.cmake
Index: llvm/cmake/modules/FindZ3.cmake
===================================================================
--- llvm/cmake/modules/FindZ3.cmake
+++ llvm/cmake/modules/FindZ3.cmake
@@ -37,7 +37,7 @@
RUN_OUTPUT_VARIABLE SRC_OUTPUT
)
- if(Z3_COMPILED)
+ if(Z3_COMPILED AND NOT (Z3_RETURNCODE STREQUAL FAILED_TO_RUN))
string(REGEX REPLACE "([0-9]*\\.[0-9]*\\.[0-9]*)" "\\1"
z3_version "${SRC_OUTPUT}")
set(Z3_VERSION_STRING ${z3_version} PARENT_SCOPE)
@@ -82,25 +82,23 @@
# If the dynamic check fails, we might be cross compiling: if that's the case,
# check the version in the headers, otherwise, fail with a message
-if(NOT Z3_VERSION_STRING AND (CMAKE_CROSSCOMPILING AND
- Z3_INCLUDE_DIR AND
- EXISTS "${Z3_INCLUDE_DIR}/z3_version.h"))
+if(NOT Z3_VERSION_STRING AND (Z3_INCLUDE_DIR AND EXISTS "${Z3_INCLUDE_DIR}/z3_version.h"))
# TODO: print message warning that we couldn't find a compatible lib?
# Z3 4.8.1+ has the version is in a public header.
file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
z3_version_str REGEX "^#define[\t ]+Z3_MAJOR_VERSION[\t ]+.*")
- string(REGEX REPLACE "^.*Z3_MAJOR_VERSION[\t ]+([0-9]).*$" "\\1"
+ string(REGEX REPLACE "^.*Z3_MAJOR_VERSION[\t ]+([0-9]+).*$" "\\1"
Z3_MAJOR "${z3_version_str}")
file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
z3_version_str REGEX "^#define[\t ]+Z3_MINOR_VERSION[\t ]+.*")
- string(REGEX REPLACE "^.*Z3_MINOR_VERSION[\t ]+([0-9]).*$" "\\1"
+ string(REGEX REPLACE "^.*Z3_MINOR_VERSION[\t ]+([0-9]+).*$" "\\1"
Z3_MINOR "${z3_version_str}")
file(STRINGS "${Z3_INCLUDE_DIR}/z3_version.h"
z3_version_str REGEX "^#define[\t ]+Z3_BUILD_NUMBER[\t ]+.*")
- string(REGEX REPLACE "^.*Z3_BUILD_NUMBER[\t ]+([0-9]).*$" "\\1"
+ string(REGEX REPLACE "^.*Z3_BUILD_NUMBER[\t ]+([0-9]+).*$" "\\1"
Z3_BUILD "${z3_version_str}")
set(Z3_VERSION_STRING ${Z3_MAJOR}.${Z3_MINOR}.${Z3_BUILD})
@@ -122,4 +120,4 @@
REQUIRED_VARS Z3_LIBRARIES Z3_INCLUDE_DIR
VERSION_VAR Z3_VERSION_STRING)
-mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES)
+mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES)
\ No newline at end of file
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132441.454733.patch
Type: text/x-patch
Size: 2294 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220823/a2860890/attachment.bin>
More information about the llvm-commits
mailing list