Add support for C++20 and MSVC 2022

This commit is contained in:
Michael Fabian 'Xaymar' Dirks
2022-06-10 20:07:33 +02:00
parent f7e1554ec2
commit ca57d43562
+16 -6
View File
@@ -152,7 +152,19 @@ function(generate_compile_commands_json)
## C++ Standard
get_target_property(_el ${_target} CXX_STANDARD)
if(COMPILER_TAG STREQUAL "MSVC")
if(${MSVC_VERSION} GREATER_EQUAL "1920")
if(${MSVC_VERSION} GREATER_EQUAL "1930")
if((_el EQUAL 98) OR (_el EQUAL 11))
# Nothing to do, this is the default.
elseif(_el EQUAL 14)
string(APPEND COMPILER_OPTIONS "/std:c++14 ")
elseif(_el EQUAL 17)
string(APPEND COMPILER_OPTIONS "/std:c++17 ")
elseif(_el EQUAL 20)
string(APPEND COMPILER_OPTIONS "/std:c++20 ")
elseif(_el EQUAL 23)
string(APPEND COMPILER_OPTIONS "/std:c++latest ")
endif()
elseif(${MSVC_VERSION} GREATER_EQUAL "1920")
if((_el EQUAL 98) OR (_el EQUAL 11))
# Nothing to do, this is the default.
elseif(_el EQUAL 14)
@@ -189,11 +201,9 @@ function(generate_compile_commands_json)
elseif(_el EQUAL 17)
string(APPEND COMPILER_OPTIONS "-std=c++17 ")
elseif(_el EQUAL 20)
if((COMPILER_TAG STREQUAL "CLANG") OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9))
string(APPEND COMPILER_OPTIONS "-std=c++20 ")
else()
string(APPEND COMPILER_OPTIONS "-std=c++2a ")
endif()
string(APPEND COMPILER_OPTIONS "-std=c++20 ")
elseif(_el EQUAL 23)
string(APPEND COMPILER_OPTIONS "-std=c++23 ")
endif()
endif()
## Definitions