Merge pull request #7220 from ethereum/z3CMakeFix

CMake: Properly disable z3, if z3 version cannot be determined.
This commit is contained in:
chriseth 2019-08-13 11:49:52 +02:00 committed by GitHub
commit 98e3caa28a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,15 +19,20 @@ if (USE_Z3)
find_library(Z3_LIBRARY NAMES z3) find_library(Z3_LIBRARY NAMES z3)
find_program(Z3_EXECUTABLE z3 PATH_SUFFIXES bin) find_program(Z3_EXECUTABLE z3 PATH_SUFFIXES bin)
if(Z3_INCLUDE_DIR AND Z3_LIBRARY AND Z3_EXECUTABLE) if(Z3_INCLUDE_DIR AND Z3_LIBRARY)
execute_process (COMMAND ${Z3_EXECUTABLE} -version if(Z3_EXECUTABLE)
OUTPUT_VARIABLE libz3_version_str execute_process (COMMAND ${Z3_EXECUTABLE} -version
ERROR_QUIET OUTPUT_VARIABLE libz3_version_str
OUTPUT_STRIP_TRAILING_WHITESPACE) ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(REGEX REPLACE "^Z3 version ([0-9.]+).*" "\\1" string(REGEX REPLACE "^Z3 version ([0-9.]+).*" "\\1"
Z3_VERSION_STRING "${libz3_version_str}") Z3_VERSION_STRING "${libz3_version_str}")
unset(libz3_version_str) unset(libz3_version_str)
else()
message(WARNING "Could not determine the version of z3, since the z3 executable was not found.")
set(Z3_VERSION_STRING "0.0.0")
endif()
endif() endif()
mark_as_advanced(Z3_VERSION_STRING z3_DIR) mark_as_advanced(Z3_VERSION_STRING z3_DIR)