[PATCH] D54978: Move the SMT API to LLVM
Brian Rzycki via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 13 08:32:59 PST 2019
brzycki added a comment.
> perhaps something like this:
>
> if(Z3_INCLUDE_DIR AND EXISTS "${Z3_INCLUDE_DIR }/z3_version.h")
> file(STRINGS "${Z3_INCLUDE_DIR }/z3_version.h" z3_version_str REGEX "^#define[\t ]+Z3_FULL_VERSION[\t ]+\".*\"")
>
> string(REGEX REPLACE "^.*Z3_FULL_VERSION[\t ]+\"Z3 ([0-9\.]+)\".*$" "\\1" Z3_VERSION_STRING "${z3_version_str}")
> unset(z3_version_str)
> endif()
That is almost exactly what I was thinking about this morning. I'd prefer the following since it's more robust for older versions:
if(Z3_INCLUDE_DIR AND EXISTS "${Z3_INCLUDE_DIR }/z3_version.h")
# For 4.8.0 or newer
file(STRINGS "${Z3_INCLUDE_DIR }/z3_version.h" z3_version_str REGEX "^#define[\t ]+Z3_FULL_VERSION[\t ]+\".*\"")
string(REGEX REPLACE "^.*Z3_FULL_VERSION[\t ]+\"Z3 ([0-9\.]+)\".*$" "\\1" Z3_VERSION_STRING "${z3_version_str}")
unset(z3_version_str)
elseif(Z3_INCLUDE_DIR AND EXISTS "${Z3_INCLUDE_DIR }/version.h")
file(STRINGS "${Z3_INCLUDE_DIR }/version.h" z3_version_str REGEX "^#define[\t ]+Z3_FULL_VERSION[\t ]+\".*\"")
string(REGEX REPLACE "^.*Z3_FULL_VERSION[\t ]+\"Z3 ([0-9\.]+)\".*$" "\\1" Z3_VERSION_STRING "${z3_version_str}")
unset(z3_version_str)
else()
message(WARNING "Unable to locate the Z3 version.h header. Setting the found version to 0.0.0.")
set(Z3_VERSION_STRING "0.0.0")
endif()
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D54978/new/
https://reviews.llvm.org/D54978
More information about the cfe-commits
mailing list