about summary refs log tree commit diff homepage
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorDan Liew <daniel.liew@imperial.ac.uk>2017-07-25 14:59:31 +0100
committerDan Liew <daniel.liew@imperial.ac.uk>2017-07-28 08:19:52 +0100
commit0c964b4792d2d575ef1a3032589943412df5923c (patch)
treebc8b1f70cc706fa543dcc62b98145c10341d8021 /CMakeLists.txt
parentb46f8186e60a18ec81e2f03783482c76ac234880 (diff)
downloadklee-0c964b4792d2d575ef1a3032589943412df5923c.tar.gz
[CMake] Refactor STP detection and change the default value of
`ENABLE_SOLVER_STP` to be set dynamically based on whether STP is
available. Previously the default was always off.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt37
1 files changed, 2 insertions, 35 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e066b89e..325997c2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -307,41 +307,8 @@ include(${CMAKE_SOURCE_DIR}/cmake/compiler_warnings.cmake)
 ################################################################################
 # Solvers
 ################################################################################
-
-# STP: Use CMake facility to detect. The user can pass `-DSTP_DIR=` to force
-# a particular directory.
-option(ENABLE_SOLVER_STP "Enable STP solver support" OFF)
-if (ENABLE_SOLVER_STP)
-  message(STATUS "STP solver support enabled")
-  # Although find_package() will set `STP_DIR` for us add it here so that
-  # is displayed in `ccmake` and `cmake-gui`.
-  set(STP_DIR "" CACHE PATH "Path to directory containing STPConfig.cmake")
-  find_package(STP CONFIG)
-  if (STP_FOUND)
-    message(STATUS "Found STP version ${STP_VERSION}")
-    # Try the STP shared library first
-    if ("${STP_SHARED_LIBRARY}" STREQUAL "")
-      # Try the static library instead
-      if ("${STP_STATIC_LIBRARY}" STREQUAL "")
-        message(FATAL_ERROR "Couldn't find STP shared or static library")
-      endif()
-      message(STATUS "Using STP static library")
-      list(APPEND KLEE_SOLVER_LIBRARIES "${STP_STATIC_LIBRARY}")
-    else()
-      message(STATUS "Using STP shared library")
-      list(APPEND KLEE_SOLVER_LIBRARIES "${STP_SHARED_LIBRARY}")
-    endif()
-    list(APPEND KLEE_COMPONENT_EXTRA_INCLUDE_DIRS "${STP_INCLUDE_DIRS}")
-    message(STATUS "STP_DIR: ${STP_DIR}")
-    set(ENABLE_STP 1) # For config.h
-  else()
-    message(FATAL_ERROR "STP not found. Try setting `-DSTP_DIR=/path` where"
-      " `/path` is the directory containing `STPConfig.cmake`")
-  endif()
-else()
-  message(STATUS "STP solver support disabled")
-  set(ENABLE_STP 0) # For config.h
-endif()
+# STP
+include(${CMAKE_SOURCE_DIR}/cmake/find_stp.cmake)
 
 # Z3
 option(ENABLE_SOLVER_Z3 "Enable Z3 solver support" OFF)