Skip to content

Commit

Permalink
Remove stale references to C++14.
Browse files Browse the repository at this point in the history
The main branch was upgraded to use C++17 after the 29.0 branch cut, in commit
fe53593

There are still stale references to C++14 in the code, build chain, and
READMEs. This commit cleans up the stale configs and settings.

PiperOrigin-RevId: 706000867
  • Loading branch information
tonyliaoss authored and copybara-github committed Dec 13, 2024
1 parent 0a95ae4 commit f4cc92c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test_cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ jobs:
cache_key: Bazel7
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75"
targets: "//src/... //third_party/utf8_range/..."
# TODO: remove -Wno-unreachable-code" when dropping C++14
- config: { name: "Bazel7 with Bzlmod", flags: --enable_bzlmod --enable_workspace --per_file_copt=.*/absl/strings/string_view.h@-Wno-unreachable-code --cxxopt="-Wno-self-assign-overloaded" }
- config: { name: "Bazel7 with Bzlmod", flags: --enable_bzlmod --enable_workspace --cxxopt="-Wno-self-assign-overloaded" }
cache_key: Bazel7bzlmod
image: "us-docker.pkg.dev/protobuf-build/containers/common/linux/bazel:7.1.2-27cf7b86212020d7e552bc13b1e084abb971da75"
targets: "//src/... //third_party/utf8_range/..."
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ set(protobuf_LINK_LIBATOMIC false)
if (NOT MSVC)
include(CheckCXXSourceCompiles)
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++14)
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} -std=c++17)
check_cxx_source_compiles("
#include <atomic>
int main() {
Expand Down
14 changes: 8 additions & 6 deletions cmake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,18 @@ the same actions can be performed using appropriate GUI tools.

## C++ Version

By default, CMake will use whatever C++ version is the system default. Since
protobuf requires C++14 or newer, sometimes you will need to explicitly override
this. For example, the following:
By default, CMake will use whatever C++ version is the system default. Since
protobuf requires C++17 or newer, sometimes you will need to explicitly override
this. For example, the following:

```
cmake . -DCMAKE_CXX_STANDARD=14
cmake . -DCMAKE_CXX_STANDARD=17
cmake --build .
```

will build protobuf using C++14 (see [CXX_STANDARD](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD){.external} for all available options).
will build protobuf using C++17 (see
[CXX_STANDARD](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD.html#prop_tgt:CXX_STANDARD){.external}
for all available options).

# Windows Builds

Expand Down Expand Up @@ -118,7 +120,7 @@ For example:
```console
C:\Path\to\build\protobuf> cmake -S. -Bcmake-out \
-DCMAKE_INSTALL_PREFIX=/tmp/protobuf \
-DCMAKE_CXX_STANDARD=14 \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_PREFIX_PATH=/tmp/absl # Path to where I installed Abseil
```

Expand Down

0 comments on commit f4cc92c

Please sign in to comment.