Build: Switch to C++20

This commit is contained in:
Stenzek 2023-09-05 20:57:18 +10:00
parent 9b47561c89
commit 58b4946fb9
2 changed files with 10 additions and 3 deletions

View file

@ -142,9 +142,7 @@ if(ANDROID)
endif()
# Detect C++ version support.
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Warning disables.
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
include(CheckCXXFlag)
check_cxx_flag(-Wall COMPILER_SUPPORTS_WALL)
@ -229,8 +227,16 @@ if(BUILD_TESTS)
enable_testing()
endif()
# Use C++17 for building dependencies (some aren't C++20-aware, e.g. reshadefx).
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Recursively include the source tree.
add_subdirectory(dep)
# Use C++20 for building the main libraries.
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_subdirectory(src)
if(ANDROID)

View file

@ -3,6 +3,7 @@
<ItemDefinitionGroup>
<ClCompile>
<AdditionalIncludeDirectories>$(SolutionDir)src;%(AdditionalIncludeDirectories);$(SolutionDir)dep\gsl\include;$(SolutionDir)dep\fast_float\include;$(SolutionDir)dep\fmt\include;$(SolutionDir)dep\zlib\include;$(SolutionDir)dep\minizip\include;$(SolutionDir)dep\stb\include</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
</ClCompile>
</ItemDefinitionGroup>