aboutsummaryrefslogtreecommitdiffstats
path: root/cmake/FindCVC4.cmake
blob: 887b907b8320c04b06a25dbb1ad23741126b319f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
if (USE_CVC4)
    find_path(CVC4_INCLUDE_DIR cvc4/cvc4.h)
    find_library(CVC4_LIBRARY NAMES cvc4)
    include(FindPackageHandleStandardArgs)
    find_package_handle_standard_args(CVC4 DEFAULT_MSG CVC4_LIBRARY CVC4_INCLUDE_DIR)
    if(CVC4_FOUND)
        # CVC4 may depend on either CLN or GMP.
        # We can assume that the one it requires is present on the system,
        # so we quietly try to find both and link against them, if they are
        # present.
        find_package(CLN QUIET)
        find_package(GMP QUIET)

        set(CVC4_LIBRARIES ${CVC4_LIBRARY})

        if (CLN_FOUND)
            set(CVC4_LIBRARIES ${CVC4_LIBRARIES} CLN::CLN)
        endif ()

        if (GMP_FOUND)
            set(CVC4_LIBRARIES ${CVC4_LIBRARIES} GMP::GMP)
        endif ()

        if (NOT TARGET CVC4::CVC4)
            add_library(CVC4::CVC4 UNKNOWN IMPORTED)
            set_property(TARGET CVC4::CVC4 PROPERTY IMPORTED_LOCATION ${CVC4_LIBRARY})
            set_property(TARGET CVC4::CVC4 PROPERTY INTERFACE_LINK_LIBRARIES ${CVC4_LIBRARIES})
            set_property(TARGET CVC4::CVC4 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CVC4_INCLUDE_DIR})
        endif()
    endif()
else()
    set(CVC4_FOUND FALSE)
endif()