diff --git a/CMakeLists.txt b/CMakeLists.txt index d8b4e56..3b14bdc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ set(CMAKE_CXX_FLAGS_RELEASE "-Os") set(MINIMAL_GNU "11.0") set(MINIMAL_CLANG "14.0.1") set(MINIMAL_MSVC "19.30") +option(IGNORE_MINIMAL_COMPILER_VERSION "Whether or not to ignore the minimal compiler versions") set(IS_GNU (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU)) set(IS_CLANG (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)) @@ -78,7 +79,7 @@ include(CheckIPOSupported) check_ipo_supported(RESULT CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE LANGUAGES CXX) if (${IS_GNU}) - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMAL_GNU}) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMAL_GNU} AND NOT ${IGNORE_MINIMAL_COMPILER_VERSION}) message(FATAL_ERROR "G++ ${MINIMAL_GNU} or higher is required.") endif() if (Threads_FOUND) @@ -89,7 +90,7 @@ if (${IS_GNU}) set(CMAKE_CXX_FLAGS_RELEASE "-fwhole-program ${CMAKE_CXX_FLAGS_RELEASE}") endif() elseif(${IS_CLANG}) - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMAL_CLANG}) + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMAL_CLANG} AND NOT ${IGNORE_MINIMAL_COMPILER_VERSION}) message(FATAL_ERROR "Clang ${MINIMAL_CLANG} or higher is required.") endif() if (${CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE} OR MINGW) # CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE is false on llvm-mingw toolchains even though it is supported @@ -100,7 +101,7 @@ elseif(${IS_CLANG}) endif() set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fstrict-vtable-pointers") elseif(MSVC) - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMAL_MSVC}) + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS ${MINIMAL_MSVC} AND NOT ${IGNORE_MINIMAL_COMPILER_VERSION}) message(FATAL_ERROR "MSVC ${MINIMAL_MSVC} or higher is required") endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR /W3 /Zc:__cplusplus /Zc:preprocessor /Zc:throwingNew /Zc:inline")