From 277ce1ddc2e6d8d3687f3f5e3c95ef1db04c787a Mon Sep 17 00:00:00 2001 From: Derek Mauro Date: Mon, 29 Aug 2022 16:52:14 -0700 Subject: CMake: Add an option to build the libraries that are used for writing tests without requiring Abseil's tests be built (default=OFF) This disables building libraries that are only used for writing tests by default. The logging library releases some libraries used for writing tests that themselves depend on GoogleTest. This allows Abseil to build by default without requiring GoogleTest. Fixes #1262 PiperOrigin-RevId: 470847215 Change-Id: I296f41aa06d6f302853af3f32e1f762649504afc --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 995d90e5..706af68a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,6 +114,10 @@ include(CMakeDependentOption) option(ABSL_BUILD_TESTING "If ON, Abseil will build all of Abseil's own tests." OFF) +option(ABSL_BUILD_TEST_HELPERS + "If ON, Abseil will build libraries that you can use to write tests against Abseil code. This option requires that Abseil is configured to use GoogleTest." + OFF) + option(ABSL_USE_EXTERNAL_GOOGLETEST "If ON, Abseil will assume that the targets for GoogleTest are already provided by the including project. This makes sense when Abseil is used with add_subdirectory." OFF) @@ -133,7 +137,7 @@ set(ABSL_LOCAL_GOOGLETEST_DIR "/usr/src/googletest" CACHE PATH "If ABSL_USE_GOOGLETEST_HEAD is OFF and ABSL_GOOGLETEST_URL is not set, specifies the directory of a local GoogleTest checkout." ) -if(BUILD_TESTING AND ABSL_BUILD_TESTING) +if((BUILD_TESTING AND ABSL_BUILD_TESTING) OR ABSL_BUILD_TEST_HELPERS) ## check targets if (ABSL_USE_EXTERNAL_GOOGLETEST) if (ABSL_FIND_GOOGLETEST) -- cgit v1.2.3