@@ -53,6 +53,9 @@ if (CMAKE_COMPILER_IS_GNUCC)
5353 OUTPUT_VARIABLE GCC_VERSION
5454 OUTPUT_STRIP_TRAILING_WHITESPACE )
5555 message (VERBOSE "Using gcc ${GCC_VERSION} as the compiler" )
56+ if (GCC_VERSION VERSION_LESS 9.0)
57+ message (ERROR "gcc minimum version is 9.0" )
58+ endif ()
5659else ()
5760 set (GCC_VERSION 0)
5861endif ()
@@ -71,6 +74,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER MATCHES "[Cc]lan
7174 string (REGEX REPLACE ".* version ([0-9]+\\ .[0-9]+).*" "\\ 1" APPLECLANG_VERSION_STRING ${clang_full_version_string} )
7275 set (ANY_CLANG_VERSION_STRING ${APPLECLANG_VERSION_STRING} )
7376 message (VERBOSE "The compiler is Clang: ${CMAKE_CXX_COMPILER_ID } version ${APPLECLANG_VERSION_STRING} " )
77+ if (APPLECLANG_VERSION_STRING VERSION_LESS 5.0)
78+ message (ERROR "Apple clang minimum version is 5.0" )
79+ elseif (APPLECLANG_VERSION_STRING VERSION_LESS 10.0)
80+ message (WARNING "Apple clang minimum version is 10.0. Older versions might work, but we don't test or support them." )
81+ endif ()
7482 elseif (CMAKE_CXX_COMPILER_ID MATCHES "IntelLLVM" )
7583 set (CMAKE_COMPILER_IS_INTELCLANG 1)
7684 string (REGEX MATCH "[0-9]+(\\ .[0-9]+)+" INTELCLANG_VERSION_STRING ${clang_full_version_string} )
@@ -81,6 +89,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER MATCHES "[Cc]lan
8189 string (REGEX REPLACE ".* version ([0-9]+\\ .[0-9]+).*" "\\ 1" CLANG_VERSION_STRING ${clang_full_version_string} )
8290 set (ANY_CLANG_VERSION_STRING ${CLANG_VERSION_STRING} )
8391 message (VERBOSE "The compiler is Clang: ${CMAKE_CXX_COMPILER_ID } version ${CLANG_VERSION_STRING} " )
92+ if (CLANG_VERSION_STRING VERSION_LESS 5.0)
93+ message (ERROR "clang minimum version is 5.0" )
94+ elseif (CLANG_VERSION_STRING VERSION_LESS 10.0)
95+ message (WARNING "clang minimum version is 10.0. Older versions might work, but we don't test or support them." )
96+ endif ()
8497 endif ()
8598elseif (CMAKE_CXX_COMPILER_ID MATCHES "Intel" )
8699 set (CMAKE_COMPILER_IS_INTEL 1)
@@ -157,11 +170,10 @@ if (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG)
157170 add_compile_options ("-Qunused-arguments" )
158171 # Don't warn if we ask it not to warn about warnings it doesn't know
159172 add_compile_options ("-Wunknown-warning-option" )
160- if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 3.6 OR
161- APPLECLANG_VERSION_STRING VERSION_GREATER 6.1)
173+ if (CLANG_VERSION_STRING OR APPLECLANG_VERSION_STRING VERSION_GREATER 6.1)
162174 add_compile_options ("-Wno-unused-local-typedefs" )
163175 endif ()
164- if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 3.9 )
176+ if (CLANG_VERSION_STRING)
165177 # Don't warn about using unknown preprocessor symbols in `#if`
166178 add_compile_options ("-Wno-expansion-to-defined" )
167179 endif ()
@@ -174,10 +186,8 @@ if (CMAKE_COMPILER_IS_GNUCC AND NOT (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_I
174186 # gcc specific options
175187 add_compile_options ("-Wno-unused-local-typedefs" )
176188 add_compile_options ("-Wno-unused-result" )
177- if (NOT ${GCC_VERSION} VERSION_LESS 7.0)
178- add_compile_options ("-Wno-aligned-new" )
179- add_compile_options ("-Wno-noexcept-type" )
180- endif ()
189+ add_compile_options ("-Wno-aligned-new" )
190+ add_compile_options ("-Wno-noexcept-type" )
181191endif ()
182192
183193if (INTELCLANG_VERSION_STRING VERSION_GREATER_EQUAL 2022.1.0)
@@ -284,10 +294,8 @@ endif ()
284294# legit problem later.
285295#
286296set (GLIBCXX_USE_CXX11_ABI "" CACHE STRING "For gcc, use the new C++11 library ABI (0|1)" )
287- if (CMAKE_COMPILER_IS_GNUCC AND ${GCC_VERSION} VERSION_GREATER_EQUAL 5.0)
288- if (NOT ${GLIBCXX_USE_CXX11_ABI} STREQUAL "" )
289- add_compile_definitions (_GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI} )
290- endif ()
297+ if (CMAKE_COMPILER_IS_GNUCC AND NOT ${GLIBCXX_USE_CXX11_ABI} STREQUAL "" )
298+ add_compile_definitions (_GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI} )
291299endif ()
292300
293301
0 commit comments