Various fixes

- Add C23 support
- Add C++23 support
- Fix generate_compile_command for non-MSVC
This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2024-02-14 05:07:24 +01:00
parent 7e577af2e9
commit 654f2bcc20
+7 -5
View File
@@ -125,14 +125,16 @@ endfunction()
macro(cstd_to_flag output version default)
set(${output} "${default}")
if(MSVC)
if("${version}" GREATER_EQUAL 17)
if("${version}" GREATER_EQUAL 23)
set(${output} "/std:clatest")
elseif("${version}" GREATER_EQUAL 17)
set(${output} "/std:c17")
elseif("${version}" GREATER_EQUAL 11)
set(${output} "/std:c11")
endif()
else()
if("${version}" GREATER_EQUAL 23)
set(${output} "-std=c2x")
set(${output} "-std=c23")
elseif("${version}" GREATER_EQUAL 17)
set(${output} "-std=c17")
elseif("${version}" GREATER_EQUAL 11)
@@ -148,7 +150,7 @@ endmacro()
macro(cxxstd_to_flag output version default)
set(${output} "${default}")
if(MSVC)
if("${version}" GREATER_EQUAL 23)
if("${version}" GREATER_EQUAL 21)
set(${output} "/std:c++latest")
elseif("${version}" GREATER_EQUAL 20)
set(${output} "/std:c++20")
@@ -159,7 +161,7 @@ macro(cxxstd_to_flag output version default)
endif()
else()
if("${version}" GREATER_EQUAL 23)
set(${output} "-std=c++23")
set(${output} "-std=c++2b")
elseif("${version}" GREATER_EQUAL 20)
set(${output} "-std=c++20")
elseif("${version}" GREATER_EQUAL 17)
@@ -201,7 +203,7 @@ function(generate_compile_commands_json)
if(CMAKE_GENERATOR IN_LIST cc_generators)
foreach(current_target ${_ARGS_TARGETS})
set_target_properties(${current_target} PROPERTIES
CMAKE_EXPORT_COMPILE_COMMANDS ON
EXPORT_COMPILE_COMMANDS ON
)
endforeach()
return()