build: Update the default C++ standard
Remove the C++17 from the pw_build INTERFACE library and set C++20 as
the standard for the host toolchains.
Change-Id: Iec4963ae81d86ff298980b1a20cfa15e80f90401
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/178913
Reviewed-by: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
Presubmit-Verified: CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com>
Commit-Queue: Yuval Peress <peress@google.com>
diff --git a/pw_build/CMakeLists.txt b/pw_build/CMakeLists.txt
index 62a3105..4d22be3 100644
--- a/pw_build/CMakeLists.txt
+++ b/pw_build/CMakeLists.txt
@@ -27,7 +27,6 @@
$<$<CXX_COMPILER_ID:GNU>:-fdiagnostics-color=always>
PUBLIC_DEPS
pw_build.reduced_size
- pw_build.cpp17
)
if(ZEPHYR_PIGWEED_MODULE_DIR)
target_link_libraries(pw_build INTERFACE zephyr_interface)
diff --git a/pw_toolchain/host_clang/toolchain.cmake b/pw_toolchain/host_clang/toolchain.cmake
index 6cb29c0..37d8586 100644
--- a/pw_toolchain/host_clang/toolchain.cmake
+++ b/pw_toolchain/host_clang/toolchain.cmake
@@ -29,6 +29,8 @@
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
+pw_add_global_compile_options(-std=c++20 LANGUAGES CXX)
+
# Configure backend for assert facade.
pw_set_backend(pw_assert.check pw_assert.print_and_abort_check_backend)
pw_set_backend(pw_assert.assert pw_assert.print_and_abort_assert_backend)
diff --git a/pw_toolchain/host_gcc/toolchain.cmake b/pw_toolchain/host_gcc/toolchain.cmake
index ed011e2..019c3ae 100644
--- a/pw_toolchain/host_gcc/toolchain.cmake
+++ b/pw_toolchain/host_gcc/toolchain.cmake
@@ -29,6 +29,8 @@
set(CMAKE_C_COMPILER gcc)
set(CMAKE_CXX_COMPILER g++)
+pw_add_global_compile_options(-std=c++20 LANGUAGES CXX)
+
# Configure backend for assert facade.
pw_set_backend(pw_assert.check pw_assert.print_and_abort_check_backend)
pw_set_backend(pw_assert.assert pw_assert.print_and_abort_assert_backend)