set(RESOURCE_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/resources)

file(MAKE_DIRECTORY ${RESOURCE_INSTALL_LOCATION}/include)
file(MAKE_DIRECTORY ${RESOURCE_INSTALL_LOCATION}/lib)



ExternalProject_Add(
    z3
    LOG_CONFIGURE 1
    LOG_DOWNLOAD 1
    LOG_BUILD 1
    GIT_REPOSITORY https://github.com/Z3Prover/z3.git
    GIT_SHALLOW 1
    GIT_TAG z3-4.8.8
    UPDATE_COMMAND ""
    CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${RESOURCE_INSTALL_LOCATION}"
    INSTALL_COMMAND ${CMAKE_MAKE_PROGRAM} install
)

set( z3_INCLUDE_DIR "${RESOURCE_INSTALL_LOCATION}/include" )
set( z3_LIBRARY "${RESOURCE_INSTALL_LOCATION}/lib/${CMAKE_FIND_LIBRARY_PREFIXES}z3${CMAKE_SHARED_LIBRARY_SUFFIX}")

add_imported_library(z3 SHARED "${z3_LIBRARY}" "${z3_INCLUDE_DIR}")
add_dependencies(resources z3)