2022-07-15 05:12:01 +08:00
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
|
|
index a0d07d1..18320b6 100644
|
2022-01-20 02:48:18 +08:00
|
|
|
--- a/CMakeLists.txt
|
|
|
|
+++ b/CMakeLists.txt
|
2022-04-07 03:01:56 +08:00
|
|
|
@@ -43,6 +43,14 @@ if (APPLE AND NOT DEFINED CMAKE_CXX_STANDARD)
|
2022-07-15 05:12:01 +08:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
2022-04-07 03:01:56 +08:00
|
|
|
endif ()
|
2022-01-20 02:48:18 +08:00
|
|
|
|
|
|
|
+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)
|
2022-04-07 03:01:56 +08:00
|
|
|
+endif ()
|
|
|
|
+
|
|
|
|
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
2022-07-15 05:12:01 +08:00
|
|
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3)
|
2022-04-07 03:01:56 +08:00
|
|
|
message(
|
2022-01-20 02:48:18 +08:00
|
|
|
diff --git a/google/cloud/internal/port_platform.h b/google/cloud/internal/port_platform.h
|
2022-07-15 05:12:01 +08:00
|
|
|
index b61eb48..327278f 100644
|
2022-01-20 02:48:18 +08:00
|
|
|
--- a/google/cloud/internal/port_platform.h
|
|
|
|
+++ b/google/cloud/internal/port_platform.h
|
|
|
|
@@ -49,6 +49,8 @@
|
2022-07-15 05:12:01 +08:00
|
|
|
// Abort compilation if the compiler does not support C++14.
|
|
|
|
#if GOOGLE_CLOUD_CPP_CPP_VERSION < 201402L
|
|
|
|
# error "C++14 or newer is required"
|
2022-01-20 02:48:18 +08:00
|
|
|
+#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"
|
2022-07-15 05:12:01 +08:00
|
|
|
#endif // GOOGLE_CLOUD_CPP_CPP_VERSION < 201402L
|
2022-01-20 02:48:18 +08:00
|
|
|
|
2022-07-15 05:12:01 +08:00
|
|
|
// Abort the build if the version of the compiler is too old. This simplifies
|