From f05177db2a1a930649593f6f98a74af350b8bf6c Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 24 Jan 2024 00:08:04 +0100 Subject: [PATCH] Improve CMake error message if C++17 is not used with CEF The previous error didn't make sense if CMAKE_CXX_STANDARD wasn't set, so use a slightly different message in this case. Also improve the comment explaining why we need C++17 in the first place. Co-Authored-By: Maarten Bent --- build/cmake/init.cmake | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index ca24b5b848..488586943b 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -533,8 +533,18 @@ if(wxUSE_GUI) if (NOT wxHAVE_CXX17) # We shouldn't disable this option as it's disabled by default and # if it is on, it means that CEF is meant to be used, but we can't - # continue neither as libcef_dll_wrapper will fail to build. - message(FATAL_ERROR "WebviewChromium requires at least C++17 but configured to use C++${CMAKE_CXX_STANDARD}") + # continue neither as libcef_dll_wrapper will fail to build + # (actually it may still succeed with CEF v116 which provided + # its own stand-in for std::in_place used in CEF headers, but + # not with the later versions, so just fail instead of trying + # to detect CEF version here, as even v116 officially only + # supports C++17 anyhow). + if (DEFINED CMAKE_CXX_STANDARD) + set(cxx17_error_details "configured to use C++${CMAKE_CXX_STANDARD}") + else() + set(cxx17_error_details "the compiler doesn't support C++17 by default and CMAKE_CXX_STANDARD is not set") + endif() + message(FATAL_ERROR "WebviewChromium requires at least C++17 but ${cxx17_error_details}") endif() endif() endif()