From 42dc328fe3a4c6b21b9c7bff2f7390cdab09e542 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 8 Jul 2024 12:12:37 +0200 Subject: [PATCH] Update gcc minimum required version warning (#2482) Update the minimum required gcc version to provide a more actionable warning than sth like `'reduce' is not a member of 'std'` (see e.g. #2463). --- CMakeLists.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aaa0b39810..2dc0ada467 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,10 +36,11 @@ message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - # require at least gcc 4.9, otherwise regex wont work properly - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9) - message(FATAL_ERROR "GCC version must be at least 4.9!") +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMPILER_ID}" + STREQUAL "MINGW") + # require at least gcc 9.1 for proper C+17 support, e.g. std::reduce + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.1) + message(FATAL_ERROR "GCC version must be at least 9.1!") endif() endif() @@ -147,8 +148,7 @@ else() set(VENDORED_SUNDIALS_INSTALL_DIR ${VENDORED_SUNDIALS_BUILD_DIR}) endif() set(SUNDIALS_ROOT "${VENDORED_SUNDIALS_INSTALL_DIR}/${CMAKE_INSTALL_LIBDIR}") -find_package( - SUNDIALS REQUIRED CONFIG PATHS "${SUNDIALS_ROOT}/cmake/sundials/") +find_package(SUNDIALS REQUIRED CONFIG PATHS "${SUNDIALS_ROOT}/cmake/sundials/") message(STATUS "Found SUNDIALS: ${SUNDIALS_DIR}") set(GSL_LITE_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/gsl")