From 6cdec0cdfe759fe3474ab324e6095714fd9f71d9 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 15 Aug 2022 15:24:14 +0800 Subject: [PATCH] cmake: enforce gcc-10 for win32 port we only have GCC-10 targeting MinGW at the time of writing, and it is good enough for compiling the Winows port. so let's relax the requirement to enable the windows build. Signed-off-by: Kefu Chai --- src/CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f22ff7b2b9fea..bf89a3aea78d8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -115,8 +115,15 @@ if(COMPILER_SUPPORTS_REDUNDANT_MOVE) add_compile_options($<$:-Wredundant-move>) endif() if(CMAKE_CXX_COMPILER_ID STREQUAL GNU) - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 11) # require >= gcc-11 - message(FATAL_ERROR "C++20 support requires a minimum GCC version of 11.") + if(WIN32) + # require >= gcc-10 for compiling the windows port + set(minimum_gcc_version 10) + else() + # require >= gcc-11 for compiling the whole tree + set(minimum_gcc_version 11) + endif() + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS minimum_gcc_version) + message(FATAL_ERROR "C++20 support requires a minimum GCC version of ${minimum_gcc_version}.") endif() if(MINGW) # The MINGW headers are missing some "const" qualifiers. -- 2.39.5