diff --git a/CMakeLists.txt b/CMakeLists.txt index efcfb3a..9d77165 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,13 @@ cmake_minimum_required(VERSION 3.15) project(CloudStreamingArgsDebugger LANGUAGES CXX) +# Use C++20 project-wide. The GitHub Actions build.yml invokes cl with +# /std:c++20 directly; keep the CMake path in sync so the two build modes +# compile the same language. +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + # Specify that this is a Win32 application with wWinMain entry point set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS") diff --git a/path_info.cpp b/path_info.cpp index 037f6af..024f7a8 100644 --- a/path_info.cpp +++ b/path_info.cpp @@ -30,8 +30,6 @@ template std::wstring FillWithGrowingBuffer(Fill fill) for (int attempt = 0; attempt < 6; ++attempt) { SetLastError(ERROR_SUCCESS); - // `&buf[0]` yields `wchar_t*` in both C++17 and C++20; `buf.data()` - // would only do so in C++20. Tests compile with C++17. DWORD len = fill(&buf[0], static_cast(buf.size())); if (len == 0) return {}; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 127332b..db11ddc 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -4,9 +4,11 @@ project(ArgumentDebuggerTests LANGUAGES CXX) # Explicitly specify that tests are console applications set(CMAKE_WIN32_EXECUTABLE OFF) -# Set C++ standard -set(CMAKE_CXX_STANDARD 17) +# Set C++ standard (kept in sync with the top-level CMakeLists.txt and with +# the /std:c++20 flag used by .github/workflows/build.yml). +set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) # Find GoogleTest package find_package(GTest CONFIG REQUIRED)