find_path(Z3_INCLUDE_DIR NAMES z3.h
   PATH_SUFFIXES libz3
   )

find_library(Z3_LIBRARIES NAMES z3 libz3
   )

find_program(Z3_EXECUTABLE z3)

if(Z3_INCLUDE_DIR AND Z3_EXECUTABLE)
    execute_process (COMMAND ${Z3_EXECUTABLE} -version
      OUTPUT_VARIABLE libz3_version_str
      ERROR_QUIET
      OUTPUT_STRIP_TRAILING_WHITESPACE)

    string(REGEX REPLACE "^Z3 version ([0-9.]+)" "\\1"
           Z3_VERSION_STRING "${libz3_version_str}")
    unset(libz3_version_str)
endif()

# handle the QUIETLY and REQUIRED arguments and set Z3_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3
                                  REQUIRED_VARS Z3_LIBRARIES Z3_INCLUDE_DIR
                                  VERSION_VAR Z3_VERSION_STRING)

mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES)

find_path(Z3_INCLUDE_DIR NAMES z3.h
   PATH_SUFFIXES libz3 z3
   )

find_library(Z3_LIBRARIES NAMES z3 libz3
   )

find_program(Z3_EXECUTABLE z3)

if(Z3_INCLUDE_DIR AND Z3_EXECUTABLE)
    execute_process (COMMAND ${Z3_EXECUTABLE} -version
      OUTPUT_VARIABLE libz3_version_str
      ERROR_QUIET
      OUTPUT_STRIP_TRAILING_WHITESPACE)

    string(REGEX REPLACE "^Z3 version ([0-9.]+)" "\\1"
           Z3_VERSION_STRING "${libz3_version_str}")
    unset(libz3_version_str)
endif()

# handle the QUIETLY and REQUIRED arguments and set Z3_FOUND to TRUE if
# all listed variables are TRUE
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Z3
                                  REQUIRED_VARS Z3_LIBRARIES Z3_INCLUDE_DIR
                                  VERSION_VAR Z3_VERSION_STRING)

mark_as_advanced(Z3_INCLUDE_DIR Z3_LIBRARIES)

Support Gentoo install for z3
[cmake] Support Gentoo install for z3

Add the 'z3' subdirectory to the list of possible path suffixes for
libz3 header search. The z3 headers are installed in /usr/include/z3
on Gentoo.

Differential Revision: https://reviews.llvm.org/D31756

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@299813 91177308-0d34-0410-b5e6-96231b3b80d8
