diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index d5830869..98bf07bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -618,24 +618,43 @@ option(ENABLE_KLEE_LIBCXX "Enable libcxx for klee" OFF) if (ENABLE_KLEE_LIBCXX) message(STATUS "klee-libcxx support enabled") set(SUPPORT_KLEE_LIBCXX 1) # For config.h - set(KLEE_LIBCXX_EXTERNAL_OBJECT "" CACHE PATH "Path to llvm libcxx shared object") - if (NOT EXISTS "${KLEE_LIBCXX_EXTERNAL_OBJECT}") + set(KLEE_LIBCXX_DIR "" CACHE PATH "Path to root directory with libcxx shared object") + if (NOT EXISTS "${KLEE_LIBCXX_DIR}") message(FATAL_ERROR - "${KLEE_LIBCXX_EXTERNAL_OBJECT} does not exist. Try passing -DKLEE_LIBCXX_EXTERNAL_OBJECT=<path>") + "${KLEE_LIBCXX_PATH} does not exist. Try passing -DKLEE_LIBCXX_DIR=<path>") endif() if (NOT IS_DIRECTORY "${KLEE_LIBCXX_INCLUDE_DIR}") message(FATAL_ERROR "${KLEE_LIBCXX_INCLUDE_DIR} does not exist. Try passing -DKLEE_LIBCXX_INCLUDE_DIR=<path>") endif() - - set(KLEE_LIBCXX_BC_NAME "libcxx.so.bc") + message(STATUS "Use libc++ include path: \"${KLEE_LIBCXX_INCLUDE_DIR}\"") + + # Find the library bitcode archive + + # Check for static first + set(KLEE_LIBCXX_BC_NAME "libc++.bca") + set(KLEE_LIBCXX_BC_PATH "${KLEE_LIBCXX_DIR}/lib/${KLEE_LIBCXX_BC_NAME}") + if (NOT EXISTS "${KLEE_LIBCXX_BC_PATH}") + # Check for dynamic so lib + set(KLEE_LIBCXX_BC_NAME "libc++.so.bc") + set(KLEE_LIBCXX_BC_PATH "${KLEE_LIBCXX_DIR}/lib/${KLEE_LIBCXX_BC_NAME}") + if (NOT EXISTS "${KLEE_LIBCXX_BC_PATH}") + set(KLEE_LIBCXX_BC_NAME "libc++.dylib.bc") + set(KLEE_LIBCXX_BC_PATH "${KLEE_LIBCXX_DIR}/lib/${KLEE_LIBCXX_BC_NAME}") + if (NOT EXISTS "${KLEE_LIBCXX_BC_PATH}") + message(FATAL_ERROR + "libc++ library not found at \"${KLEE_LIBCXX_DIR}\"") + endif() + endif() + endif() + message(STATUS "Found libc++ library: \"${KLEE_LIBCXX_BC_PATH}\"") # Make a symlink to KLEE_LIBCXX_EXTERNAL_OBJECT so KLEE can find it where it # is expected. file(MAKE_DIRECTORY "${KLEE_RUNTIME_DIRECTORY}") execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - "${KLEE_LIBCXX_EXTERNAL_OBJECT}" + "${KLEE_LIBCXX_BC_PATH}" "${KLEE_RUNTIME_DIRECTORY}/${KLEE_LIBCXX_BC_NAME}" ) list(APPEND KLEE_COMPONENT_CXX_DEFINES @@ -644,13 +663,13 @@ if (ENABLE_KLEE_LIBCXX) # Add libcxx to the install target. We install the original # file rather than the symlink because CMake would just copy the symlink # rather than the file. - install(FILES "${KLEE_LIBCXX_EXTERNAL_OBJECT}" + install(FILES "${KLEE_LIBCXX_BC_PATH}" DESTINATION "${KLEE_INSTALL_RUNTIME_DIR}" RENAME "${KLEE_LIBCXX_BC_NAME}" ) else() - message(STATUS "libcxx support disabled") + message(STATUS "libc++ support disabled") set(SUPPORT_KLEE_LIBCXX 0) # For config.h endif() |