8 Commits

Author SHA1 Message Date
Esun Kim
dc65036957 [C++] Transition to C++17 (CMake) (#38335)
CMake needs following two changes which were missed part from https://github.com/grpc/grpc/pull/37919 to make CMake use C++17.
- **Explicitly require C++17 for gRPC targets using `cxx_std_17`**: This ensures that gRPC build targets are built with the correct C++17 support.
- **Enforce C++17 for all CMake invocations using `CMAKE_CXX_STANDARD=17`**: This is necessary due to Abseil's API changes depending on the C++ standard used. (e.g. Abseil's `absl::string_view` is implemented differently depending on the C++ standard. Before C++17, it's a distinct type. From C++17 onwards, it's simply an alias for `std::string_view`.) To maintain consistency and avoid build errors, all CMake builds (except particular build tests targetting C++20 or C++23) are now configured to use C++17.

The requirement of C++17 for building gRPC should be documented in the release notes and build instructions.

Closes #38335

PiperOrigin-RevId: 712926964
2025-01-07 08:48:11 -08:00
Esun Kim
a49d450a54 [Build] Bumped the minimum version of cmake (#37702)
Per https://github.com/google/oss-policies-info/blob/main/foundational-cxx-support-matrix.md, the minimum version of cmake to support is 3.16 so let's change our cmake builds' requirements accordingly.

Closes #37702

COPYBARA_INTEGRATE_REVIEW=https://github.com/grpc/grpc/pull/37702 from veblush:cmake316 bb4ed1a1be5e9374980c922aac3dc1ccd27d1266
PiperOrigin-RevId: 680639191
2024-09-30 10:55:14 -07:00
Eugene Ostroukhov
d9e4d1302e [examples] Implement custom metrics reporting from server (#35218) 2023-12-08 14:33:59 -08:00
Ravi Prakash
d8699afe20 [example] Eliminate warning when building helloworld. (#32884)
Without this change, new users get this warning:
```
CMake Warning (dev) at $MY_INSTALL_DIR/lib64/cmake/protobuf/protobuf-options.cmake:6 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'protobuf_MODULE_COMPATIBLE'.
Call Stack (most recent call first):
  $MY_INSTALL_DIR/lib64/cmake/protobuf/protobuf-config.cmake:2 (include)
  $MY_SRC_PATH/examples/cpp/cmake/common.cmake:99 (find_package)
  CMakeLists.txt:24 (include)
This warning is for project developers.  Use -Wno-dev to suppress it.
```

release notes: no


<!--

If you know who should review your pull request, please assign it to
that
person, otherwise the pull request would get assigned randomly.

If your pull request is for a specific language, please add the
appropriate
lang label.

-->
2023-05-02 13:01:07 -07:00
Esun Kim
b64d623f24 CMake's better handling c++14 requirement (#31916)
* Bumped the cmake version version to 3.8

* Switch to target_compile_features for cxx_std_14

* Regen
2023-01-27 09:51:31 -08:00
h-vetinari
a562807108 patch cpp example to use passed CMAKE_CXX_STANDARD (#30835) 2022-09-13 12:36:34 -07:00
Esun Kim
03e9ac6f1f Requiring C++14 (#29589) 2022-05-12 21:17:32 -07:00
Esun Kim
69bb5e328e Added CMakeLists for route_guide example 2020-12-22 13:44:35 -08:00