Skip to content

CMake's better handling c++14 requirement#31916

Merged
veblush merged 3 commits intogrpc:masterfrom
veblush:cmake-cpp14
Jan 27, 2023
Merged

CMake's better handling c++14 requirement#31916
veblush merged 3 commits intogrpc:masterfrom
veblush:cmake-cpp14

Conversation

@veblush
Copy link
Copy Markdown
Contributor

@veblush veblush commented Dec 16, 2022

As Cmake got a better way to specify that C++14 or above is required with target_compile_features, gRPC needs to use this instead of using CMAKE_CXX_STANDARD which should be done by the application. This is also aligned with how Cloud C++ does.

In order for gRPC to get this change, the minium version of cmake should be bumped to 3.8, which is acceptable as OSS C++ policy needs 3.10 as the oldest version of cmake to support.

@veblush veblush added the release notes: no Indicates if PR should not be in release notes label Dec 16, 2022
@veblush veblush force-pushed the cmake-cpp14 branch 2 times, most recently from 2e0208d to 6d1060d Compare January 23, 2023 20:25
@veblush veblush requested a review from jtattermusch January 23, 2023 22:08
@veblush veblush marked this pull request as ready for review January 23, 2023 22:08
@veblush
Copy link
Copy Markdown
Contributor Author

veblush commented Jan 23, 2023

CC @coryan

@veblush veblush force-pushed the cmake-cpp14 branch 2 times, most recently from 1f541ec to 2ebc5d9 Compare January 24, 2023 16:59
@veblush
Copy link
Copy Markdown
Contributor Author

veblush commented Jan 27, 2023

@drfloob AJ, would you review this as Jan is OOO?

Copy link
Copy Markdown
Contributor

@jtattermusch jtattermusch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks fine, but I had one concern - see comment.


if compiler == 'default' or compiler == 'cmake':
return ('debian11', [])
return ('debian11', ["-DCMAKE_CXX_STANDARD=14"])
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels odd that to our "default" build via run_tests.py we need to pass extra options.
Would that mean that if one builds with cmake by hand, without passing any extra configuration, they would get a differently configured build that if they run run_tests.py? If so, that feels wrong.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is required because of Apple clang which uses C++98 by default (yay). Also this is only for tests and gRPC library targets don't specify it so that C++ version can be picked by applications.

@veblush veblush merged commit b64d623 into grpc:master Jan 27, 2023
@copybara-service copybara-service bot added the imported Specifies if the PR has been imported to the internal repository label Jan 27, 2023
XuanWang-Amos pushed a commit to XuanWang-Amos/grpc that referenced this pull request May 1, 2023
* Bumped the cmake version version to 3.8

* Switch to target_compile_features for cxx_std_14

* Regen
wanlin31 pushed a commit that referenced this pull request May 18, 2023
* Bumped the cmake version version to 3.8

* Switch to target_compile_features for cxx_std_14

* Regen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build bloat/none imported Specifies if the PR has been imported to the internal repository lang/c++ per-call-memory/neutral per-channel-memory/neutral release notes: no Indicates if PR should not be in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants