@@ -17,7 +17,7 @@ project(KLEE CXX C)
1717# Project version
1818###############################################################################
1919set (KLEE_VERSION_MAJOR 3)
20- set (KLEE_VERSION_MINOR 0 )
20+ set (KLEE_VERSION_MINOR 1 )
2121set (KLEE_VERSION "${KLEE_VERSION_MAJOR} .${KLEE_VERSION_MINOR} " )
2222
2323# If a patch is needed, we can add KLEE_VERSION_PATCH
@@ -317,6 +317,16 @@ if (NOT SQLite3_FOUND)
317317 message ( FATAL_ERROR "SQLite3 not found, please install" )
318318endif ()
319319
320+ find_program (
321+ SQLITE_CLI
322+ NAMES "sqlite3"
323+ DOC "Path to sqlite3 tool"
324+ )
325+
326+ if (NOT SQLITE_CLI)
327+ set (SQLITE_CLI "" )
328+ endif ()
329+
320330################################################################################
321331# Detect libcap
322332################################################################################
@@ -548,51 +558,44 @@ option(ENABLE_KLEE_LIBCXX "Enable libc++ for klee" OFF)
548558if (ENABLE_KLEE_LIBCXX)
549559 message (STATUS "klee-libc++ support enabled" )
550560 set (SUPPORT_KLEE_LIBCXX 1) # For config.h
551- set (KLEE_LIBCXX_DIR "" CACHE PATH "Path to directory containing libc++ shared object (bitcode)" )
552- if (NOT EXISTS "${KLEE_LIBCXX_DIR} " )
553- message (FATAL_ERROR
554- "KLEE_LIBCXX_DIR (\" ${KLEE_LIBCXX_DIR} \" ) does not exist.\n "
555- "Try passing -DKLEE_LIBCXX_DIR=<path> to CMake where <path> is the path"
556- "to the directory containing the libc++ shared object file (as bitcode)." )
557- endif ()
558561
559- set (KLEE_LIBCXX_INCLUDE_DIR "" CACHE PATH "Path to libc++ include directory" )
560- if (NOT EXISTS "${KLEE_LIBCXX_INCLUDE_DIR} " )
561- message (FATAL_ERROR
562- "KLEE_LIBCXX_INCLUDE_DIR (\" ${KLEE_LIBCXX_INCLUDE_DIR} \" ) does not exist.\n "
563- "Try passing -DKLEE_LIBCXX_INCLUDE_DIR=<path> to CMake where <path> is the"
564- "libc++ include directory." )
565- endif ()
566- message (STATUS "Use libc++ include path: \" ${KLEE_LIBCXX_INCLUDE_DIR} \" " )
567-
568- # Find the library bitcode archive
569-
570- # Check for static first
571- set (KLEE_LIBCXX_BC_NAME "libc++.bca" )
572- set (KLEE_LIBCXX_BC_PATH "${KLEE_LIBCXX_DIR} /lib/${KLEE_LIBCXX_BC_NAME} " )
573- if (NOT EXISTS "${KLEE_LIBCXX_BC_PATH} " )
574- # Check for dynamic so lib
575- set (KLEE_LIBCXX_BC_NAME "libc++.so.bc" )
576- set (KLEE_LIBCXX_BC_PATH "${KLEE_LIBCXX_DIR} /lib/${KLEE_LIBCXX_BC_NAME} " )
577- if (NOT EXISTS "${KLEE_LIBCXX_BC_PATH} " )
578- set (KLEE_LIBCXX_BC_NAME "libc++.dylib.bc" )
579- set (KLEE_LIBCXX_BC_PATH "${KLEE_LIBCXX_DIR} /lib/${KLEE_LIBCXX_BC_NAME} " )
580- if (NOT EXISTS "${KLEE_LIBCXX_BC_PATH} " )
581- message (FATAL_ERROR
582- "libc++ library not found at \" ${KLEE_LIBCXX_DIR} \" " )
583- endif ()
584- endif ()
585- endif ()
562+ find_file (KLEE_LIBCXX_BC_PATH
563+ NAMES libc++.bca libc++.so.bc libc++.dylib.bc
564+ DOC "Path to directory containing libc++ shared object (bitcode)"
565+ PATH_SUFFIXES "lib" "lib/x86_64-unknown-linux-gnu"
566+ HINTS ${KLEE_LIBCXX_DIR}
567+ REQUIRED
568+ )
586569 message (STATUS "Found libc++ library: \" ${KLEE_LIBCXX_BC_PATH} \" " )
587570
571+ find_path (KLEE_LIBCXX_PLATFORM_INCLUDE_PATH
572+ NAMES __config_site #We are searching for a platform-specific C++ library header called `__config_site`
573+ DOC "Path to platform-specific libc++ include directory"
574+ PATH_SUFFIXES "x86_64-unknown-linux-gnu/c++/v1" "include/x86_64-unknown-linux-gnu/c++/v1"
575+ HINTS ${KLEE_LIBCXX_INCLUDE_DIR}
576+ NO_DEFAULT_PATH # Make sure we don't pick-up the standard library's path
577+ )
578+
579+ find_path (KLEE_LIBCXX_INCLUDE_PATH
580+ NAMES cerrno #We are searching for a C++ library header called `cerrno`
581+ DOC "Path to libc++ include directory"
582+ PATH_SUFFIXES "c++/v1" "include/c++/v1"
583+ HINTS ${KLEE_LIBCXX_INCLUDE_DIR}
584+ REQUIRED
585+ NO_DEFAULT_PATH # Make sure we don't pick-up the standard library's path
586+ )
587+
588+ message (STATUS "Found libc++ include path: ${KLEE_LIBCXX_INCLUDE_PATH} and ${KLEE_LIBCXX_PLATFORM_INCLUDE_PATH} " )
589+
590+
588591 # Copy KLEE_LIBCXX_BC_PATH so KLEE can find it where it is expected.
589592 file (MAKE_DIRECTORY "${KLEE_RUNTIME_DIRECTORY} " )
590593 execute_process (COMMAND ${CMAKE_COMMAND} -E copy
591594 "${KLEE_LIBCXX_BC_PATH} "
592- "${KLEE_RUNTIME_DIRECTORY} /${KLEE_LIBCXX_BC_NAME } "
595+ "${KLEE_RUNTIME_DIRECTORY} /${KLEE_LIBCXX_BC_PATH } "
593596 )
594597 list (APPEND KLEE_COMPONENT_CXX_DEFINES
595- -DKLEE_LIBCXX_BC_NAME=\"${KLEE_LIBCXX_BC_NAME } \" )
598+ -DKLEE_LIBCXX_BC_NAME=\"${KLEE_LIBCXX_BC_PATH } \" )
596599
597600else()
598601 message(STATUS " libc++ support disabled")
0 commit comments