From 755ab26f6512defa427ead70a890fa34db76e2bc Mon Sep 17 00:00:00 2001 From: Joseph Schuchart Date: Tue, 28 May 2024 11:39:25 -0400 Subject: [PATCH] Check for broken GCC versions and disable Coroutine support if found Signed-off-by: Joseph Schuchart --- CMakeLists.txt | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 28490557f..26433deb5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,8 +94,23 @@ endif (BUILD_TESTING) ########################### # Boost include("${PROJECT_SOURCE_DIR}/cmake/modules/FindOrFetchBoost.cmake") -# C++ coroutines -find_package(CXXStdCoroutine MODULE REQUIRED COMPONENTS Final Experimental) + +# C++ coroutines, check for broken GCC releases and skip if one is found +set(SKIP_COROUTINE_DETECTION FALSE) +if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + if (${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 11.4.0) + set(SKIP_COROUTINE_DETECTION TRUE) + elseif(${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER_EQUAL 12.1.0 AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 12.3.0) + set(SKIP_COROUTINE_DETECTION TRUE) + endif() + if (SKIP_COROUTINE_DETECTION) + message(WARNING "GCC with broken Coroutine support detected, disabling Coroutine support. At least GCC 11.4, 12.3, or 13.1 required.") + endif(SKIP_COROUTINE_DETECTION) +endif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + +if (SKIP_COROUTINE_DETECTION) + find_package(CXXStdCoroutine MODULE REQUIRED COMPONENTS Final Experimental) +endif(SKIP_COROUTINE_DETECTION) ##########################