diff options
author | Eric Barndollar <eric@EricWBarndollar.com> | 2021-07-29 21:33:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 21:33:51 -0400 |
commit | ee0ebdae4a9e789b92f5abbe8573ddeeaead4864 (patch) | |
tree | 171f8b99d3a784943abf99e104dd0bb787e86b7c /FAQ.md | |
parent | 89c531c1e0d7372e2e7029f072a35495c5447d61 (diff) |
CMake: option to use cxx_std_11 (minimum) that propagates. (#986)
See https://github.com/abseil/abseil-cpp/issues/259 for context.
This change introduces the ABSL_PROPAGATE_CXX_STD option (default to OFF for now, though it prints a warning in CMake 2.8+ builds that a future Abseil release will default to ON). When enabled, all Abseil CMake targets will set the cxx_std_11 target meta feature (which will then propagate to targets that depend upon Abseil) rather than setting the target-level CXX_STANDARD property to CMAKE_CXX_STANDARD (which is the default value anyway), which doesn't propagate.
Updates README documentation to clarify behavior and with a different example recommendation for library projects (which should generally leave CMAKE_CXX_STANDARD to the root application project).
See https://crascit.com/2015/03/28/enabling-cxx11-in-cmake/ for a useful overview of these different CMake features surrounding C++ standard version configuration.
Diffstat (limited to 'FAQ.md')
-rw-r--r-- | FAQ.md | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -27,7 +27,10 @@ compiler, there several ways to do this: file](https://docs.bazel.build/versions/master/guide.html#bazelrc) If you are using CMake as the build system, you'll need to add a line like -`set(CMAKE_CXX_STANDARD 17)` to your top level `CMakeLists.txt` file. See the +`set(CMAKE_CXX_STANDARD 17)` to your top level `CMakeLists.txt` file. If you +are developing a library designed to be used by other clients, you should +instead leave `CMAKE_CXX_STANDARD` unset and configure the minimum C++ standard +required by each of your library targets via `target_compile_features`. See the [CMake build instructions](https://github.com/abseil/abseil-cpp/blob/master/CMake/README.md) for more information. |