Adds feature check for c++26

This commit is contained in:
2025-11-17 04:31:36 -05:00
parent fdfc8b62ec
commit 272b44be0a
3 changed files with 23 additions and 2 deletions

View File

@@ -1 +1,2 @@
include(features/reflection)
include(features/reflection)
include(features/c++26)

View File

@@ -0,0 +1,16 @@
cmake_minimum_required(VERSION 3.26)
project(TestCXX)
# Default to C++23
set(STD_VERSION 23)
# Check if the compiler supports C++26
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-std=c++26" COMPILER_SUPPORTS_CXX26)
if(COMPILER_SUPPORTS_CXX26)
set(STD_VERSION 26)
endif()
add_executable(${PROJECT_NAME} main.cpp)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_${STD_VERSION})

View File

@@ -23,7 +23,11 @@ function(ConfigureFGLTarget NAME SRC_DIR INCLUDE_DIR)
target_compile_definitions(${NAME} PUBLIC "-DFGL_STRICT_WARNINGS=1")
endif ()
target_compile_features(${NAME} PUBLIC cxx_std_26)
if (COMPILER_SUPPORTS_CXX26)
target_compile_features(${NAME} PUBLIC cxx_std_26)
else ()
target_compile_features(${NAME} PUBLIC cxx_std_23)
endif ()
endfunction()
function(SplitDebugSymbols NAME)