vcpkg/ports/google-cloud-cpp/support_absl_cxx17.patch
Carlos O'Ryan ce9dc455ef
[google-cloud-cpp] update to latest release (v2.0.0) (#25608)
* [google-cloud-cpp] update to latest release (v2.0.0)

* Disable `channel` and `asset` features on Windows

Protobuf <= 3.19 does not know about the `TRUE` and `DOMAIN` macros on
Windows, so it cannot hide said macros when used as enum values in a
proto file.  vcpkg uses protobuf==3.19.4

* Fix formatting

* Fix versions
2022-07-14 14:12:01 -07:00

33 lines
1.2 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a0d07d1..18320b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -43,6 +43,14 @@ if (APPLE AND NOT DEFINED CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
endif ()
+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)
+endif ()
+
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.3)
message(
diff --git a/google/cloud/internal/port_platform.h b/google/cloud/internal/port_platform.h
index b61eb48..327278f 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++14.
#if GOOGLE_CLOUD_CPP_CPP_VERSION < 201402L
# error "C++14 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 < 201402L
// Abort the build if the version of the compiler is too old. This simplifies