-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[google-cloud-cpp] Support abseil[cxx17] (#21942)
* [google-cloud-cpp] Support abseil[cxx17] Signed-off-by: Daniel Lundborg <daniel.lundborg@sandvik.com> * [google-cloud-cpp] add version Signed-off-by: Daniel Lundborg <daniel.lundborg@sandvik.com>
- Loading branch information
Showing
5 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index 369914e04..f89b256f4 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -28,8 +28,14 @@ project( | ||
VERSION 1.35.0 | ||
LANGUAGES CXX C) | ||
|
||
+find_package(absl CONFIG REQUIRED) | ||
+ | ||
+# Use CMAKE_CXX_STANDARD=17 if ABSL_USE_CXX17 is set | ||
+if (ABSL_USE_CXX17) | ||
+ message(STATUS "Found absl uses CXX17, enable CXX17 feature.") | ||
+ set(CMAKE_CXX_STANDARD 17) | ||
# Allow applications to override the CMAKE_CXX_STANDARD, but if not set use 11. | ||
-if (NOT CMAKE_CXX_STANDARD) | ||
+elseif (NOT CMAKE_CXX_STANDARD) | ||
set(CMAKE_CXX_STANDARD 11) | ||
endif () | ||
if (CMAKE_CXX_STANDARD VERSION_LESS 11) | ||
diff --git a/google/cloud/internal/port_platform.h b/google/cloud/internal/port_platform.h | ||
index c9f34cf4c..e62400431 100644 | ||
--- a/google/cloud/internal/port_platform.h | ||
+++ b/google/cloud/internal/port_platform.h | ||
@@ -49,6 +49,8 @@ | ||
// Abort compilation if the compiler does not support C++11. | ||
#if GOOGLE_CLOUD_CPP_CPP_VERSION < 201103L | ||
# error "C++11 or newer is required" | ||
+#elif defined(ABSL_USE_CXX17) && GOOGLE_CLOUD_CPP_CPP_VERSION < 201703L | ||
+# error "Compiled to use Abseil with C++17 support, but using with C++ < C++17" | ||
#endif // GOOGLE_CLOUD_CPP_CPP_VERSION < 201103L | ||
|
||
// Abort the build if the version of the compiler is too old. With CMake we |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters