Don't give an error if compiler supports C++17 by default
Previously CMake would give an error if CMAKE_CXX_STANDARD wasn't explicitly set to C++17 or greater when using CEF, but this is not really needed if the compiler supports C++17 without any non-default options, so check for this too.
This commit is contained in:
parent
5480296dd0
commit
fca0c75b2e
1 changed files with 30 additions and 5 deletions
|
|
@ -506,11 +506,36 @@ if(wxUSE_GUI)
|
|||
message(WARNING "WebviewChromium libcef_dll_wrapper can only be built with MSVC... disabled")
|
||||
wx_option_force_value(wxUSE_WEBVIEW_CHROMIUM OFF)
|
||||
endif()
|
||||
if(wxUSE_WEBVIEW_CHROMIUM AND CMAKE_CXX_STANDARD LESS 17)
|
||||
# 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}")
|
||||
if(wxUSE_WEBVIEW_CHROMIUM)
|
||||
# Check for C++17 support as it's required by CEF: we trust
|
||||
# CMAKE_CXX_STANDARD if it is defined, but we need to compile a
|
||||
# test program if it is not because the compiler could be
|
||||
# supporting C++17 anyway.
|
||||
if (DEFINED CMAKE_CXX_STANDARD)
|
||||
if (CMAKE_CXX_STANDARD GREATER_EQUAL 17)
|
||||
set(wxHAVE_CXX17 ON)
|
||||
endif()
|
||||
else()
|
||||
check_cxx_source_compiles("
|
||||
#if defined(_MSVC_LANG)
|
||||
#if _MSVC_LANG < 201703L
|
||||
#error C++17 support is required
|
||||
#endif
|
||||
#elif __cplusplus < 201703L
|
||||
#error C++17 support is required
|
||||
#endif
|
||||
int main() {
|
||||
[[maybe_unused]] auto unused = 17;
|
||||
}"
|
||||
wxHAVE_CXX17)
|
||||
endif()
|
||||
|
||||
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}")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue