From fb7dd24b18e82893e5922be5d1c8ae0f3fe3c9fa Mon Sep 17 00:00:00 2001 From: Matt Armstrong Date: Fri, 10 Dec 2021 10:50:53 -0800 Subject: cmake: add ABSL_BUILD_TESTING option (#1057) Abseil's own tests now are disabled if either BUILD_TESTING or a new option called ABSL_BUILD_TESTING is false. Additionally, Abseil's CMakeLists.txt no longer re-declares the BUILD_TESTING option with a value of false. Abseil had been using just the BUILD_TESTING option, since the fix for #901. Because setting BUILD_TESTING false still works to disable Abseil's tests, this change preserves the behavior asked for in that issue. Previous to that, Abseil had a project specific flag for this, as is the typical idiom used in other projects. The issue with BUILD_TESTING is that it is an all-or-nothing policy. When Abseil is incorporated as a subproject, the encompasing project has no convenient way to enable its own tests while disabling Abseil's. Fixes #1056 --- ci/linux_gcc-latest_libstdcxx_cmake.sh | 2 +- ci/linux_gcc_alpine_cmake.sh | 2 +- ci/macos_xcode_cmake.sh | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'ci') diff --git a/ci/linux_gcc-latest_libstdcxx_cmake.sh b/ci/linux_gcc-latest_libstdcxx_cmake.sh index ab06aa05..eccb3818 100755 --- a/ci/linux_gcc-latest_libstdcxx_cmake.sh +++ b/ci/linux_gcc-latest_libstdcxx_cmake.sh @@ -54,7 +54,7 @@ for std in ${ABSL_CMAKE_CXX_STANDARDS}; do cmake /abseil-cpp \ -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ -DBUILD_SHARED_LIBS=${build_shared} \ - -DBUILD_TESTING=ON \ + -DABSL_BUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=${compilation_mode} \ -DCMAKE_CXX_STANDARD=${std} \ -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \ diff --git a/ci/linux_gcc_alpine_cmake.sh b/ci/linux_gcc_alpine_cmake.sh index bce27d29..bf2e1239 100755 --- a/ci/linux_gcc_alpine_cmake.sh +++ b/ci/linux_gcc_alpine_cmake.sh @@ -53,7 +53,7 @@ for std in ${ABSL_CMAKE_CXX_STANDARDS}; do /bin/sh -c " cmake /abseil-cpp \ -DABSL_GOOGLETEST_DOWNLOAD_URL=${ABSL_GOOGLETEST_DOWNLOAD_URL} \ - -DBUILD_TESTING=ON \ + -DABSL_BUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=${compilation_mode} \ -DCMAKE_CXX_STANDARD=${std} \ -DCMAKE_MODULE_LINKER_FLAGS=\"-Wl,--no-undefined\" && \ diff --git a/ci/macos_xcode_cmake.sh b/ci/macos_xcode_cmake.sh index 2a870cf4..71ea2534 100755 --- a/ci/macos_xcode_cmake.sh +++ b/ci/macos_xcode_cmake.sh @@ -45,7 +45,7 @@ for compilation_mode in ${ABSL_CMAKE_BUILD_TYPES}; do time cmake ${ABSEIL_ROOT} \ -GXcode \ -DBUILD_SHARED_LIBS=${build_shared} \ - -DBUILD_TESTING=ON \ + -DABSL_BUILD_TESTING=ON \ -DCMAKE_BUILD_TYPE=${compilation_mode} \ -DCMAKE_CXX_STANDARD=11 \ -DCMAKE_MODULE_LINKER_FLAGS="-Wl,--no-undefined" \ -- cgit v1.2.3