aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorambrosin <ambrosin@google.com>2022-01-26 05:24:35 -0800
committerCopybara-Service <copybara-worker@google.com>2022-01-26 05:25:35 -0800
commitf07d21117d0ca0beabcf969a3941319e9b98d6b4 (patch)
tree94a98bd8185cd0b56f4182bf8500d1b176a75f1a /cmake
parent5d4470b16c8a2e46be3d0fb93f1b8f2648960212 (diff)
downloadtink-f07d21117d0ca0beabcf969a3941319e9b98d6b4.tar.gz
Remove the use of CMake's GoogleTest module
Using recent versions of CMake causes `gtest_discover_tests` to fail when parsing `jwt/tink_test_jwt_jwk_set_converter_test`, likely because of the issue in [1]. Using `add_test` avoids the issue at the price of losing some granularity (from per test case to per test binary). [1] https://gitlab.kitware.com/cmake/cmake/-/issues/23039 PiperOrigin-RevId: 424321280
Diffstat (limited to 'cmake')
-rw-r--r--cmake/TinkBuildRules.cmake13
1 files changed, 3 insertions, 10 deletions
diff --git a/cmake/TinkBuildRules.cmake b/cmake/TinkBuildRules.cmake
index d71abc43f..f2cdef140 100644
--- a/cmake/TinkBuildRules.cmake
+++ b/cmake/TinkBuildRules.cmake
@@ -34,11 +34,6 @@
include(CMakeParseArguments)
-if (NOT ${CMAKE_VERSION} VERSION_LESS 3.9)
- include(GoogleTest)
-endif()
-
-
if (TINK_BUILD_TESTS)
enable_testing()
endif()
@@ -210,11 +205,9 @@ function(tink_cc_test)
set_property(TARGET ${_target_name} PROPERTY CXX_STANDARD ${TINK_CXX_STANDARD})
set_property(TARGET ${_target_name} PROPERTY CXX_STANDARD_REQUIRED true)
- if (${CMAKE_VERSION} VERSION_LESS 3.9)
- add_test(NAME ${_target_name} COMMAND ${_target_name} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
- else()
- gtest_discover_tests(${_target_name} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
- endif()
+ # Note: This was preferred over using gtest_discover_tests because of [1].
+ # [1] https://gitlab.kitware.com/cmake/cmake/-/issues/23039
+ add_test(NAME ${_target_name} COMMAND ${_target_name} WORKING_DIRECTORY ${CMAKE_BINARY_DIR})
endfunction(tink_cc_test)
# Declare a C++ Proto library.