aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorambrosin <ambrosin@google.com>2023-04-26 01:42:08 -0700
committerCopybara-Service <copybara-worker@google.com>2023-04-26 01:43:09 -0700
commitc01a3184b68e2a8bcb8a07fbf5c68ba7086d15e7 (patch)
tree3db37bca22e0981fff7214a629c445f2a1e8d640 /cmake
parent49fcc81b27062bcc0cc753b194cb93f05462de8c (diff)
downloadtink-c01a3184b68e2a8bcb8a07fbf5c68ba7086d15e7.tar.gz
Don't fetch googletest and whycheproof when TINK_BUILD_TESTS=OFF
PiperOrigin-RevId: 527197822
Diffstat (limited to 'cmake')
-rw-r--r--cmake/TinkWorkspace.cmake48
1 files changed, 25 insertions, 23 deletions
diff --git a/cmake/TinkWorkspace.cmake b/cmake/TinkWorkspace.cmake
index d4056dbb5..0245a233b 100644
--- a/cmake/TinkWorkspace.cmake
+++ b/cmake/TinkWorkspace.cmake
@@ -50,19 +50,33 @@ endmacro()
set(gtest_force_shared_crt ON CACHE BOOL "Tink dependency override" FORCE)
-if (NOT TINK_USE_INSTALLED_GOOGLETEST)
+if (TINK_BUILD_TESTS)
+ if (TINK_USE_INSTALLED_GOOGLETEST)
+ # This uses the CMake's FindGTest module; if successful, this call to
+ # find_package generates the targets GTest::gmock, GTest::gtest and
+ # GTest::gtest_main.
+ find_package(GTest CONFIG REQUIRED)
+ _create_interface_target(gmock GTest::gmock)
+ _create_interface_target(gtest_main GTest::gtest_main)
+ else()
+ http_archive(
+ NAME com_google_googletest
+ URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz
+ SHA256 b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5
+ )
+ endif()
+
http_archive(
- NAME com_google_googletest
- URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.tar.gz
- SHA256 b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5
+ NAME wycheproof
+ URL https://github.com/google/wycheproof/archive/d8ed1ba95ac4c551db67f410c06131c3bc00a97c.zip
+ SHA256 eb1d558071acf1aa6d677d7f1cabec2328d1cf8381496c17185bd92b52ce7545
+ DATA_ONLY
)
-else()
- # This uses the CMake's FindGTest module; if successful, this call to
- # find_package generates the targets GTest::gmock, GTest::gtest and
- # GTest::gtest_main.
- find_package(GTest CONFIG REQUIRED)
- _create_interface_target(gmock GTest::gmock)
- _create_interface_target(gtest_main GTest::gtest_main)
+
+ # Symlink the Wycheproof test data.
+ # Tests expect Wycheproof test vectors to be in a local testvectors/ folder.
+ add_directory_alias("${wycheproof_SOURCE_DIR}/testvectors"
+ "${CMAKE_BINARY_DIR}/testvectors")
endif()
if (NOT TINK_USE_INSTALLED_ABSEIL)
@@ -78,18 +92,6 @@ else()
find_package(absl REQUIRED)
endif()
-http_archive(
- NAME wycheproof
- URL https://github.com/google/wycheproof/archive/d8ed1ba95ac4c551db67f410c06131c3bc00a97c.zip
- SHA256 eb1d558071acf1aa6d677d7f1cabec2328d1cf8381496c17185bd92b52ce7545
- DATA_ONLY
-)
-
-# Symlink the Wycheproof test data.
-# Tests expect Wycheproof test vectors to be in a local testvectors/ folder.
-add_directory_alias("${wycheproof_SOURCE_DIR}/testvectors"
- "${CMAKE_BINARY_DIR}/testvectors")
-
# Don't fetch BoringSSL or look for OpenSSL if target `crypto` is already
# defined.
if (NOT TARGET crypto)