From 43365c9f2819c3d0b23be3506c08439d0e1f5b69 Mon Sep 17 00:00:00 2001 From: Michael Tautschnig Date: Mon, 15 Jan 2024 11:22:53 +0000 Subject: [PATCH] CMake builds: support system-installed CaDiCaL Just like we support system-installed MiniSat2 we now support CaDiCaL when selecting "system-cadical" as solver. Fixes: #8113 --- src/solvers/CMakeLists.txt | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/solvers/CMakeLists.txt b/src/solvers/CMakeLists.txt index 14d00cb94ee..f17e389a7e8 100644 --- a/src/solvers/CMakeLists.txt +++ b/src/solvers/CMakeLists.txt @@ -167,6 +167,19 @@ foreach(SOLVER ${sat_impl}) ${cadical_SOURCE_DIR}/src ) target_link_libraries(solvers cadical_ipasir) + elseif("${SOLVER}" STREQUAL "system-cadical") + include(CheckIncludeFileCXX) + # if/when we move to CMake 3.12 (or later) we could also check for the + # library via CMAKE_REQUIRED_LIBRARIES + find_path(cadical_header_found "cadical.hpp") + if(cadical_header_found) + message(STATUS "Building solvers with cadical (${cadical_header_found})") + target_compile_definitions(solvers PUBLIC SATCHECK_CADICAL HAVE_CADICAL) + target_include_directories(solvers PRIVATE ${cadical_header_found}) + target_link_libraries(solvers cadical) + else() + message(FATAL_ERROR "Unable to find header file for preinstalled cadical") + endif() elseif("${SOLVER}" STREQUAL "ipasir-custom") message(STATUS "Building with IPASIR solver linking: custom solver provided")