CMake: check both C & C++ compiler versions
It was possible for an unsupported clang/gcc version to be used, this seems the likely cause of errors in #120879.
This commit is contained in:
@@ -123,12 +123,24 @@ if(CMAKE_COMPILER_IS_GNUCC)
|
|||||||
The minimum supported version of GCC is 11.0.0, found ${CMAKE_C_COMPILER_VERSION}"
|
The minimum supported version of GCC is 11.0.0, found ${CMAKE_C_COMPILER_VERSION}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "11.0.0")
|
||||||
if(CMAKE_COMPILER_IS_GNUCC AND ("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "8.0"))
|
|
||||||
message(FATAL_ERROR "\
|
message(FATAL_ERROR "\
|
||||||
The minimum supported version of CLANG is 8.0, found ${CMAKE_C_COMPILER_VERSION}"
|
The minimum supported version of GCC is 11.0.0, found ${CMAKE_CXX_COMPILER_VERSION}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
elseif(CMAKE_C_COMPILER_ID MATCHES "Clang")
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
if("${CMAKE_C_COMPILER_VERSION}" VERSION_LESS "8.0")
|
||||||
|
message(FATAL_ERROR "\
|
||||||
|
The minimum supported version of CLANG is 8.0, found ${CMAKE_C_COMPILER_VERSION}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
if("${CMAKE_CXX_COMPILER_VERSION}" VERSION_LESS "8.0")
|
||||||
|
message(FATAL_ERROR "\
|
||||||
|
The minimum supported version of CLANG is 8.0, found ${CMAKE_CXX_COMPILER_VERSION}"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
||||||
if(MSVC_VERSION VERSION_LESS "1928")
|
if(MSVC_VERSION VERSION_LESS "1928")
|
||||||
# MSVC_VERSION is an internal version number, it doesn't map to something
|
# MSVC_VERSION is an internal version number, it doesn't map to something
|
||||||
|
|||||||
Reference in New Issue
Block a user