aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authortholenst <tholenst@google.com>2019-06-17 04:37:11 -0700
committerCopybara-Service <copybara-worker@google.com>2019-06-17 04:37:35 -0700
commit1e440f41404f38050ece210a41f846b9d977c3f1 (patch)
tree3f290398b81a6e823171391869b906bc6418196b /cmake
parent84f5050c35de895da227d3ab79d7e397e76ac026 (diff)
downloadtink-1e440f41404f38050ece210a41f846b9d977c3f1.tar.gz
Tink CMake: Simplify the handling of tests.
The previous syntax for GTEST_ADD_TESTS only works with later versions of cmake, see e.g. https://cmake.org/cmake/help/v3.7/module/FindGTest.html?highlight=gtest_add_tests Since we use cmake 3.7.1 in kokoro we cannot run these tests like this. Furthermore, the function gtest_add_tests is problematic for parametrized tests. Hence, we remove it and replace it with the simpler add_tests. PiperOrigin-RevId: 253555478
Diffstat (limited to 'cmake')
-rw-r--r--cmake/TinkBuildRules.cmake10
1 files changed, 3 insertions, 7 deletions
diff --git a/cmake/TinkBuildRules.cmake b/cmake/TinkBuildRules.cmake
index 5dd56485a..e2e824b78 100644
--- a/cmake/TinkBuildRules.cmake
+++ b/cmake/TinkBuildRules.cmake
@@ -32,11 +32,7 @@
include(CMakeParseArguments)
-# GoogleTest is available only since CMake version 3.9,
-# so we're using FindGTest for older versions.
-if (${CMAKE_VERSION} VERSION_LESS 3.9)
- include(FindGTest)
-else()
+if (NOT ${CMAKE_VERSION} VERSION_LESS 3.9)
include(GoogleTest)
endif()
@@ -184,8 +180,8 @@ function(tink_cc_test)
set_property(TARGET ${_target_name}
PROPERTY FOLDER "${TINK_IDE_FOLDER}/Tests")
- if (${CMAKE_VERSION} VERSION_LESS 3.10)
- gtest_add_tests(TARGET ${_target_name})
+ if (${CMAKE_VERSION} VERSION_LESS 3.9)
+ add_test(NAME ${_target_name} COMMAND ${_target_name})
else()
gtest_discover_tests(${_target_name})
endif()