Skip to content

Commit

Permalink
Add compilation for C++20 to GCC and Clang (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmoene committed Aug 17, 2022
1 parent eca0220 commit 8bfb1c5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ elseif( CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang" )
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.1.0 )
set( HAS_CPP17_FLAG TRUE )
endif()
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0.0 )
set( HAS_CPP20_FLAG TRUE )
endif()

# AppleClang: available -std flags depends on version
elseif( CMAKE_CXX_COMPILER_ID MATCHES "AppleClang" )
Expand All @@ -84,6 +87,9 @@ elseif( CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang" )
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.2.0 )
set( HAS_CPP17_FLAG TRUE )
endif()
# if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS x.x.x )
# set( HAS_CPP20_FLAG TRUE )
# endif()

# Clang: available -std flags depends on version
elseif( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
Expand All @@ -98,6 +104,9 @@ elseif( CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang" )
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0.0 )
set( HAS_CPP17_FLAG TRUE )
endif()
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0.0 )
set( HAS_CPP20_FLAG TRUE )
endif()
endif()

elseif( CMAKE_CXX_COMPILER_ID MATCHES "Intel" )
Expand Down Expand Up @@ -174,6 +183,10 @@ else()
enable_msvs_guideline_checker( ${PROGRAM}-cpp17.t )
endif()

if( HAS_CPP20_FLAG )
make_target( ${PROGRAM}-cpp20.t 20 )
endif()

if( HAS_CPPLATEST_FLAG )
make_target( ${PROGRAM}-cpplatest.t latest )
endif()
Expand Down

0 comments on commit 8bfb1c5

Please sign in to comment.