Skip to content

Commit a6375b6

Browse files
committed
Handle AppleClang separately
1 parent ecc9018 commit a6375b6

File tree

1 file changed

+28
-7
lines changed

1 file changed

+28
-7
lines changed

test/CMakeLists.txt

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ set( HAS_CPP20_FLAG FALSE )
4444
set( HAS_CPPLATEST_FLAG FALSE )
4545

4646
if( MSVC )
47+
message( STATUS "Matched: MSVC")
48+
4749
set( HAS_STD_FLAGS TRUE )
4850

4951
set( OPTIONS -W3 -EHsc )
@@ -55,12 +57,10 @@ if( MSVC )
5557
endif()
5658
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.11 )
5759
set( HAS_CPP17_FLAG TRUE )
58-
set( OPTIONS ${OPTIONS} /permissive- )
5960
endif()
6061

6162
elseif( CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang" )
62-
63-
set( CMAKE_VERBOSE_MAKEFILE ON )
63+
message( STATUS "CompilerId: '${CMAKE_CXX_COMPILER_ID}'")
6464

6565
set( HAS_STD_FLAGS TRUE )
6666
set( HAS_CPP98_FLAG TRUE )
@@ -70,6 +70,8 @@ elseif( CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang" )
7070

7171
# GNU: available -std flags depends on version
7272
if( CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
73+
message( STATUS "Matched: GNU")
74+
7375
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8.0 )
7476
set( HAS_CPP11_FLAG TRUE )
7577
endif()
@@ -79,10 +81,25 @@ elseif( CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang" )
7981
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.1.0 )
8082
set( HAS_CPP17_FLAG TRUE )
8183
endif()
82-
endif()
84+
85+
# AppleClang: available -std flags depends on version
86+
elseif( CMAKE_CXX_COMPILER_ID MATCHES "AppleClang" )
87+
message( STATUS "Matched: AppleClang")
88+
89+
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0.0 )
90+
set( HAS_CPP11_FLAG TRUE )
91+
endif()
92+
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.1.0 )
93+
set( HAS_CPP14_FLAG TRUE )
94+
endif()
95+
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.2.0 )
96+
set( HAS_CPP17_FLAG TRUE )
97+
endif()
8398

8499
# Clang: available -std flags depends on version
85-
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang" )
100+
elseif( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
101+
message( STATUS "Matched: Clang")
102+
86103
if( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.3.0 )
87104
set( HAS_CPP11_FLAG TRUE )
88105
endif()
@@ -95,9 +112,11 @@ elseif( CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang" )
95112
endif()
96113

97114
elseif( CMAKE_CXX_COMPILER_ID MATCHES "Intel" )
98-
# as is
115+
# as is
116+
message( STATUS "Matched: Intel")
99117
else()
100-
# as is
118+
# as is
119+
message( STATUS "Matched: nothing")
101120
endif()
102121

103122
# enable MS C++ Core Guidelines checker if MSVC:
@@ -114,6 +133,8 @@ endfunction()
114133
# make target, compile for given standard if specified:
115134

116135
function( make_target target std )
136+
message( STATUS "Make target: '${std}'" )
137+
117138
add_executable ( ${target} ${SOURCES} ${HDRPATH} )
118139
target_compile_options ( ${target} PRIVATE ${OPTIONS} )
119140
target_compile_definitions( ${target} PRIVATE ${DEFINITIONS} )

0 commit comments

Comments
 (0)