summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorGravatar Abseil Team <absl-team@google.com>2021-02-22 13:18:10 -0800
committerGravatar vslashg <gfalcon@google.com>2021-02-22 16:20:19 -0500
commita50ae369a30f99f79d7559002aba3413dac1bd48 (patch)
tree89fd47210f4ec6885bcd47691533fd4ebbed3fbd /CMakeLists.txt
parenta2d7f453c635e90b356017dd47049b89407c2d88 (diff)
Export of internal Abseil changes
-- 4ceae78ecef025a331985958bba12ce12d4d0a68 by Derek Mauro <dmauro@google.com>: Internal change PiperOrigin-RevId: 358888936 -- 48f69b0b46e2041bb321e8af7374d7e0b45efc25 by Derek Mauro <dmauro@google.com>: Use the standard CTest mechanism BUILD_TESTING for enabling/disabling tests in CMake Fixes #901 PiperOrigin-RevId: 358822190 GitOrigin-RevId: 4ceae78ecef025a331985958bba12ce12d4d0a68 Change-Id: Ib1ca69a42355f2a4cd4c7f5a47184c4fd8441f35
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt13
1 files changed, 6 insertions, 7 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d8c3b580..8843ee79 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,7 +41,12 @@ if (POLICY CMP0077)
cmake_policy(SET CMP0077 NEW)
endif (POLICY CMP0077)
+# Set BUILD_TESTING to OFF by default.
+# This must come before the project() and include(CTest) lines.
+OPTION(BUILD_TESTING "Build tests" OFF)
+
project(absl CXX)
+include(CTest)
# Output directory is correct by default for most build setups. However, when
# building Abseil as a DLL, it is important to have the DLL in the same
@@ -104,13 +109,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."
)
-option(ABSL_RUN_TESTS "If ON, Abseil tests will be run." OFF)
-
-if(${ABSL_RUN_TESTS})
- # enable CTest. This will set BUILD_TESTING to ON unless otherwise specified
- # on the command line
- include(CTest)
-
+if(BUILD_TESTING)
## check targets
if (NOT ABSL_USE_EXTERNAL_GOOGLETEST)
set(absl_gtest_build_dir ${CMAKE_BINARY_DIR}/googletest-build)