summaryrefslogtreecommitdiff
path: root/CMake/README.md
diff options
context:
space:
mode:
authorGravatar Matt Armstrong <matta@users.noreply.github.com>2021-12-10 10:50:53 -0800
committerGravatar GitHub <noreply@github.com>2021-12-10 13:50:53 -0500
commitfb7dd24b18e82893e5922be5d1c8ae0f3fe3c9fa (patch)
treead6c07b31a997c8723fe7e413aa1e882cfa1f9e5 /CMake/README.md
parent9336be04a242237cd41a525bedfcf3be1bb55377 (diff)
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
Diffstat (limited to 'CMake/README.md')
-rw-r--r--CMake/README.md13
1 files changed, 8 insertions, 5 deletions
diff --git a/CMake/README.md b/CMake/README.md
index f8b27e63..8134615e 100644
--- a/CMake/README.md
+++ b/CMake/README.md
@@ -20,8 +20,10 @@ googletest framework
### Step-by-Step Instructions
1. If you want to build the Abseil tests, integrate the Abseil dependency
-[Google Test](https://github.com/google/googletest) into your CMake project. To disable Abseil tests, you have to pass
-`-DBUILD_TESTING=OFF` when configuring your project with CMake.
+[Google Test](https://github.com/google/googletest) into your CMake
+project. To disable Abseil tests, you have to pass either
+`-DBUILD_TESTING=OFF` or `-DABSL_BUILD_TESTING=OFF` when configuring your
+project with CMake.
2. Download Abseil and copy it into a subdirectory in your CMake project or add
Abseil as a [git submodule](https://git-scm.com/docs/git-submodule) in your
@@ -91,7 +93,8 @@ setting a consistent `CMAKE_CXX_STANDARD` that is sufficiently high.
### Running Abseil Tests with CMake
-Use the `-DBUILD_TESTING=ON` flag to run Abseil tests.
+Use the `-DABSL_BUILD_TESTING=ON` flag to run Abseil tests. Note that
+BUILD_TESTING must also be on (the default).
You will need to provide Abseil with a Googletest dependency. There are two
options for how to do this:
@@ -109,7 +112,7 @@ For example, to run just the Abseil tests, you could use this script:
cd path/to/abseil-cpp
mkdir build
cd build
-cmake -DBUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON ..
+cmake -DABSL_BUILD_TESTING=ON -DABSL_USE_GOOGLETEST_HEAD=ON ..
make -j
ctest
```
@@ -175,7 +178,7 @@ cmake --build /temporary/build/abseil-cpp --target install
## Google Test Options
-`-DBUILD_TESTING=ON` must be set to enable testing
+`-DABSL_BUILD_TESTING=ON` must be set to enable testing
- Have Abseil download and build Google Test for you: `-DABSL_USE_EXTERNAL_GOOGLETEST=OFF` (default)
- Download and build latest Google Test: `-DABSL_USE_GOOGLETEST_HEAD=ON`