From 96eb95cb008a15fb93cf9b32b9cbef4e030a8e5a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 30 Aug 2022 21:39:17 +0200 Subject: [PATCH] don't build if compiler cannot do -std=c++20 or -std=c++2a using invalid option messes up following CHECK_xxx tests and they are cached and affect the build even if columnstore itself is disabled. --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9de589f38..785778f40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,7 +32,13 @@ MY_CHECK_CXX_COMPILER_FLAG("-std=c++20") IF (have_CXX__std_c__20) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20") ELSE() - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++2a") + MY_CHECK_CXX_COMPILER_FLAG("-std=c++2a") + IF (have_CXX__std_c__2a) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++2a") + ELSE() + MESSAGE_ONCE(CS_NO_CXX20 "C++ Compiler does not understand -std=c++20") + return() + ENDIF() ENDIF() UNSET(CMAKE_CXX_STANDARD)