Skip to content

Commit 4a5c797

Browse files
authored
Merge pull request #8159 from tautschnig/features/system-cadical
CMake builds: support system-installed CaDiCaL
2 parents 7d1d88e + 43365c9 commit 4a5c797

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/solvers/CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,19 @@ foreach(SOLVER ${sat_impl})
167167
${cadical_SOURCE_DIR}/src
168168
)
169169
target_link_libraries(solvers cadical_ipasir)
170+
elseif("${SOLVER}" STREQUAL "system-cadical")
171+
include(CheckIncludeFileCXX)
172+
# if/when we move to CMake 3.12 (or later) we could also check for the
173+
# library via CMAKE_REQUIRED_LIBRARIES
174+
find_path(cadical_header_found "cadical.hpp")
175+
if(cadical_header_found)
176+
message(STATUS "Building solvers with cadical (${cadical_header_found})")
177+
target_compile_definitions(solvers PUBLIC SATCHECK_CADICAL HAVE_CADICAL)
178+
target_include_directories(solvers PRIVATE ${cadical_header_found})
179+
target_link_libraries(solvers cadical)
180+
else()
181+
message(FATAL_ERROR "Unable to find header file for preinstalled cadical")
182+
endif()
170183
elseif("${SOLVER}" STREQUAL "ipasir-custom")
171184
message(STATUS "Building with IPASIR solver linking: custom solver provided")
172185

0 commit comments

Comments
 (0)