Index: CMakeLists.txt =================================================================== --- CMakeLists.txt +++ CMakeLists.txt @@ -406,14 +406,20 @@ option(CLANG_ANALYZER_BUILD_Z3 "Build the static analyzer with the Z3 constraint manager." OFF) +set(CLANG_ANALYZER_Z3_PREFIX "" CACHE STRING "Prefix of the Z3 constraint manager (builds the static analyzer).") + +if (CLANG_ANALYZER_Z3_PREFIX) + set(CLANG_ANALYZER_BUILD_Z3 ON CACHE BOOL "Build static analyzer." FORCE) +endif() + option(CLANG_ENABLE_PROTO_FUZZER "Build Clang protobuf fuzzer." OFF) if(NOT CLANG_ENABLE_STATIC_ANALYZER AND (CLANG_ENABLE_ARCMT OR CLANG_ANALYZER_BUILD_Z3)) message(FATAL_ERROR "Cannot disable static analyzer while enabling ARCMT or Z3") endif() -if(CLANG_ANALYZER_BUILD_Z3) - find_package(Z3 4.5) +if(CLANG_ANALYZER_BUILD_Z3 OR CLANG_ANALYZER_Z3_PREFIX) + find_package(Z3) if(Z3_FOUND) set(CLANG_ANALYZER_WITH_Z3 1) else() Index: cmake/modules/FindZ3.cmake =================================================================== --- cmake/modules/FindZ3.cmake +++ cmake/modules/FindZ3.cmake @@ -1,8 +1,10 @@ find_path(Z3_INCLUDE_DIR NAMES z3.h + PATHS ${CLANG_ANALYZER_Z3_PREFIX}/include /usr/include /usr/local/include PATH_SUFFIXES libz3 z3 ) find_library(Z3_LIBRARIES NAMES z3 libz3 + PATHS ${CLANG_ANALYZER_Z3_PREFIX}/lib ${CLANG_ANALYZER_Z3_PREFIX}/bin /usr/lib /usr/local/lib ) find_program(Z3_EXECUTABLE z3)