diff options
-rw-r--r-- | README-CMake.md | 4 | ||||
-rw-r--r-- | unittests/CMakeLists.txt | 10 |
2 files changed, 8 insertions, 6 deletions
diff --git a/README-CMake.md b/README-CMake.md index 9d7ad37d..23cb7a14 100644 --- a/README-CMake.md +++ b/README-CMake.md @@ -58,8 +58,8 @@ cmake -DCMAKE_BUILD_TYPE=Release /path/to/klee/src * `ENABLE_ZLIB` (BOOLEAN) - Enable zlib support. * `GTEST_SRC_DIR` (STRING) - Path to Google Test source tree. If it is not - specified and `USE_CMAKE_FIND_PACKAGE_LLVM` is used, CMake will try to reuse - the version included within the LLVM source tree. + specified, CMake will try to reuse the version included within the LLVM + source tree or find a system installation of Google Test. * `GTEST_INCLUDE_DIR` (STRING) - Path to Google Test include directory, if it is not under `GTEST_SRC_DIR`. diff --git a/unittests/CMakeLists.txt b/unittests/CMakeLists.txt index 2641b5b9..ca90aead 100644 --- a/unittests/CMakeLists.txt +++ b/unittests/CMakeLists.txt @@ -141,11 +141,8 @@ else() # LLVM's 'gtest' target is not reused if (NOT GTEST_SRC_DIR) - if (USE_CMAKE_FIND_PACKAGE_LLVM AND LLVM_BUILD_MAIN_SRC_DIR) + if (IS_DIRECTORY "${LLVM_BUILD_MAIN_SRC_DIR}") # build from LLVM's utils directory - # NOTE: This can only be done using USE_CMAKE_FIND_PACKAGE_LLVM as - # LLVM replaced Google Test's CMakeLists.txt with its own, - # requiring add_llvm_library() from AddLLVM.cmake. message(STATUS "Google Test: Building from LLVM's source tree.") set(GTEST_INCLUDE_DIR @@ -155,6 +152,11 @@ else() "Path to Google Test include directory" ) + # LLVM replaced Google Test's CMakeLists.txt with its own, which requires + # add_llvm_library() from AddLLVM.cmake. + list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}") + include(AddLLVM) + add_subdirectory("${LLVM_BUILD_MAIN_SRC_DIR}/utils/unittest/" "${CMAKE_CURRENT_BINARY_DIR}/gtest_build") |