Skip to content

Commit

Permalink
Add install targets for gtest
Browse files Browse the repository at this point in the history
Stand-alone builds need an installed version of gtest in order to run
the unittests.

Reviewed By: mgorny, kwk

Differential Revision: https://reviews.llvm.org/D137890
  • Loading branch information
tstellar committed Mar 11, 2023
1 parent 91f7153 commit cb38df4
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions clang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,10 @@ if(CLANG_BUILT_STANDALONE)
set(LLVM_UTILS_PROVIDED ON)
set(CLANG_TEST_DEPS FileCheck count not)
endif()
set(UNITTEST_DIR ${LLVM_THIRD_PARTY_DIR}/unittest)
if(EXISTS ${UNITTEST_DIR}/googletest/include/gtest/gtest.h
AND NOT EXISTS ${LLVM_LIBRARY_DIR}/${CMAKE_STATIC_LIBRARY_PREFIX}gtest${CMAKE_STATIC_LIBRARY_SUFFIX}
AND EXISTS ${UNITTEST_DIR}/CMakeLists.txt)
add_subdirectory(${UNITTEST_DIR} third-party/unittest)
endif()
endif()

if (NOT TARGET llvm_gtest)
message(FATAL_ERROR "llvm-gtest not found. Please install llvm-gtest or disable tests with -DLLVM_INCLUDE_TESTS=OFF")
endif()

if(LLVM_LIT)
Expand Down Expand Up @@ -506,13 +504,11 @@ endif()


if( CLANG_INCLUDE_TESTS )
if(EXISTS ${LLVM_THIRD_PARTY_DIR}/unittest/googletest/include/gtest/gtest.h)
add_subdirectory(unittests)
list(APPEND CLANG_TEST_DEPS ClangUnitTests)
list(APPEND CLANG_TEST_PARAMS
clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/test/Unit/lit.site.cfg
)
endif()
add_subdirectory(unittests)
list(APPEND CLANG_TEST_DEPS ClangUnitTests)
list(APPEND CLANG_TEST_PARAMS
clang_unit_site_config=${CMAKE_CURRENT_BINARY_DIR}/test/Unit/lit.site.cfg
)
add_subdirectory(test)
add_subdirectory(bindings/python/tests)

Expand Down

0 comments on commit cb38df4

Please sign in to comment.