Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions cmake/AISUseGTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,22 @@

include(FetchContent)

# This line is used (or not) in FetchContent_Declare to determine
# if we check for a system GoogleTest install first. When building
# with the sanitizers, we HAVE to build GoogleTest from source.
#
# lint_cmake: -readability/wonkycase
# When building with the sanitizers, we HAVE to build GoogleTest from source,
# so we skip the system package check. Otherwise, check for a system install first.
if(AIS_USE_SANITIZERS OR AIS_USE_INTEGER_SANITIZER OR AIS_USE_THREAD_SANITIZER)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/releases/download/v1.17.0/googletest-1.17.0.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP true
SYSTEM
)
set(_gtest_find_package_args "")
else()
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/releases/download/v1.17.0/googletest-1.17.0.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP true
FIND_PACKAGE_ARGS NAMES GTest # <-- Different
SYSTEM
)
set(_gtest_find_package_args FIND_PACKAGE_ARGS NAMES GTest)
endif()

# lint_cmake: -readability/wonkycase
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/releases/download/v1.17.0/googletest-1.17.0.tar.gz
DOWNLOAD_EXTRACT_TIMESTAMP true
${_gtest_find_package_args}
SYSTEM
)
# lint_cmake: +readability/wonkycase

set(INSTALL_GTEST OFF CACHE BOOL "Don't install GoogleTest")
Expand Down