cmake: Add module finder for CaDiCaL.
authorMathias Preiner <mathias.preiner@gmail.com>
Tue, 14 Aug 2018 00:37:24 +0000 (17:37 -0700)
committerMathias Preiner <mathias.preiner@gmail.com>
Sat, 22 Sep 2018 23:30:59 +0000 (16:30 -0700)
CMakeLists.txt
cmake/FindCaDiCaL.cmake [new file with mode: 0644]

index 355a315ffe9aca9b65ff63f8e257b727e7c02ffc..07bd3ac97d4f97b5f02888dcec5faeeb73497c03 100644 (file)
@@ -107,6 +107,7 @@ message(STATUS "Building ${CMAKE_BUILD_TYPE} build")
 #-----------------------------------------------------------------------------#
 
 option(ENABLE_PROOFS     "Enable proof support" OFF)
+option(USE_CADICAL       "Use CaDiCaL SAT solver" OFF)
 option(USE_CLN           "Use CLN instead of GMP" OFF)
 option(USE_CRYPTOMINISAT "Use CryptoMiniSat SAT solver" OFF)
 option(USE_SYMFPU        "Use SymFPU for floating point support" OFF)
@@ -123,10 +124,26 @@ find_package(GMP REQUIRED)
 cvc4_link_library(${GMP_LIBRARIES})
 include_directories(${GMP_INCLUDE_DIR})
 
+if(ENABLE_PROOFS)
+  add_definitions(-DCVC4_PROOF)
+endif()
+
+if(USE_CADICAL)
+  find_package(CaDiCaL REQUIRED)
+  cvc4_link_library(${CaDiCaL_LIBRARIES})
+  include_directories(${CaDiCaL_INCLUDE_DIR})
+  add_definitions(-DCVC4_USE_CADICAL)
+endif()
+
 if(USE_CLN)
   find_package(CLN 1.2.2 REQUIRED)
   cvc4_link_library(${CLN_LIBRARIES})
   include_directories(${CLN_INCLUDE_DIR})
+  set(CVC4_USE_CLN_IMP 1)
+  set(CVC4_USE_GMP_IMP 0)
+else()
+  set(CVC4_USE_CLN_IMP 0)
+  set(CVC4_USE_GMP_IMP 1)
 endif()
 
 if(USE_CRYPTOMINISAT)
@@ -139,11 +156,16 @@ if(USE_CRYPTOMINISAT)
   find_package(CryptoMiniSat REQUIRED)
   cvc4_link_library(${CryptoMiniSat_LIBRARIES})
   include_directories(${CryptoMiniSat_INCLUDE_DIR})
+  add_definitions(-DCVC4_USE_CRYPTOMINISAT)
 endif()
 
 if(USE_SYMFPU)
   find_package(SymFPU REQUIRED)
   include_directories(${SymFPU_INCLUDE_DIR})
+  add_definitions(-DCVC4_USE_SYMFPU)
+  set(CVC4_USE_SYMFPU 1)
+else()
+  set(CVC4_USE_SYMFPU 0)
 endif()
 
 #-----------------------------------------------------------------------------#
@@ -253,29 +275,6 @@ set(STRERROR_R_CHAR_P 1)
 configure_file(cvc4autoconfig.new.h.in cvc4autoconfig.h)
 include_directories(${CMAKE_CURRENT_BINARY_DIR})
 
-if(USE_CLN)
-  set(CVC4_USE_CLN_IMP 1)
-  set(CVC4_USE_GMP_IMP 0)
-else()
-  set(CVC4_USE_CLN_IMP 0)
-  set(CVC4_USE_GMP_IMP 1)
-endif()
-
-if(USE_CRYPTOMINISAT)
-  add_definitions(-DCVC4_USE_CRYPTOMINISAT)
-endif()
-
-if(USE_SYMFPU)
-  add_definitions(-DCVC4_USE_SYMFPU)
-  set(CVC4_USE_SYMFPU 1)
-else()
-  set(CVC4_USE_SYMFPU 0)
-endif()
-
-if(ENABLE_PROOFS)
-  add_definitions(-DCVC4_PROOF)
-endif()
-
 #-----------------------------------------------------------------------------#
 
 add_subdirectory(doc)
diff --git a/cmake/FindCaDiCaL.cmake b/cmake/FindCaDiCaL.cmake
new file mode 100644 (file)
index 0000000..e3a0459
--- /dev/null
@@ -0,0 +1,18 @@
+# Find CaDiCaL
+# CaDiCaL_FOUND - system has CaDiCaL lib
+# CaDiCaL_INCLUDE_DIR - the CaDiCaL include directory
+# CaDiCaL_LIBRARIES - Libraries needed to use CaDiCaL
+
+find_path(CaDiCaL_INCLUDE_DIR
+          NAMES cadical.hpp
+          PATHS "${PROJECT_SOURCE_DIR}/cadical/src")
+find_library(CaDiCaL_LIBRARIES
+             NAMES cadical
+             PATHS "${PROJECT_SOURCE_DIR}/cadical/build")
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(CaDiCaL
+  DEFAULT_MSG
+  CaDiCaL_INCLUDE_DIR CaDiCaL_LIBRARIES)
+
+mark_as_advanced(CaDiCaL_INCLUDE_DIR CaDiCaL_LIBRARIES)