Add support for C++20 and MSVC 2022
This commit is contained in:
+16
-6
@@ -152,7 +152,19 @@ function(generate_compile_commands_json)
|
|||||||
## C++ Standard
|
## C++ Standard
|
||||||
get_target_property(_el ${_target} CXX_STANDARD)
|
get_target_property(_el ${_target} CXX_STANDARD)
|
||||||
if(COMPILER_TAG STREQUAL "MSVC")
|
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))
|
if((_el EQUAL 98) OR (_el EQUAL 11))
|
||||||
# Nothing to do, this is the default.
|
# Nothing to do, this is the default.
|
||||||
elseif(_el EQUAL 14)
|
elseif(_el EQUAL 14)
|
||||||
@@ -189,11 +201,9 @@ function(generate_compile_commands_json)
|
|||||||
elseif(_el EQUAL 17)
|
elseif(_el EQUAL 17)
|
||||||
string(APPEND COMPILER_OPTIONS "-std=c++17 ")
|
string(APPEND COMPILER_OPTIONS "-std=c++17 ")
|
||||||
elseif(_el EQUAL 20)
|
elseif(_el EQUAL 20)
|
||||||
if((COMPILER_TAG STREQUAL "CLANG") OR (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9))
|
string(APPEND COMPILER_OPTIONS "-std=c++20 ")
|
||||||
string(APPEND COMPILER_OPTIONS "-std=c++20 ")
|
elseif(_el EQUAL 23)
|
||||||
else()
|
string(APPEND COMPILER_OPTIONS "-std=c++23 ")
|
||||||
string(APPEND COMPILER_OPTIONS "-std=c++2a ")
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
## Definitions
|
## Definitions
|
||||||
|
|||||||
Reference in New Issue
Block a user