From b4380b5f9e77467398d6c176fe96485c9fa0b7fd Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 5 Sep 2023 18:29:36 +0200 Subject: [PATCH] Use C++14 by default in configure when using CEF Don't default to C++11 as CEF headers are not compatible with it, so configure would succeed but the build would then fail. --- configure | 12 +++++++++++- configure.ac | 14 +++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 45662ab5d9..18c3cbd336 100755 --- a/configure +++ b/configure @@ -15340,8 +15340,18 @@ if test "$CXX" = "g++" -a "$GXX" != "yes"; then as_fn_error $? "C++ compiler is needed to build wxWidgets" "$LINENO" 5 fi -case "${wxWITH_CXX-11}" in +if test "$wxUSE_WEBVIEW_CHROMIUM" = "yes"; then + wxDEFAULT_CXXSTD=14 +else + wxDEFAULT_CXXSTD=11 +fi + +case "${wxWITH_CXX-wxDEFAULT_CXXSTD}" in 11) + if test "$wxUSE_WEBVIEW_CHROMIUM" = "yes"; then + as_fn_error $? "Using wxWebView Chromium backend requires C++14 or later." "$LINENO" 5 + fi + ax_cxx_compile_alternatives="11 0x" ax_cxx_compile_cxx11_required=true ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' diff --git a/configure.ac b/configure.ac index ff4005d27a..78f29cdad1 100644 --- a/configure.ac +++ b/configure.ac @@ -1085,10 +1085,22 @@ if test "$CXX" = "g++" -a "$GXX" != "yes"; then AC_MSG_ERROR([C++ compiler is needed to build wxWidgets]) fi +dnl CEF requires at least C++14, so default to it and not C++11 when using it. +if test "$wxUSE_WEBVIEW_CHROMIUM" = "yes"; then + wxDEFAULT_CXXSTD=14 +else + dnl By default we just need C++11. + wxDEFAULT_CXXSTD=11 +fi + dnl AX_CXX_COMPILE_STDCXX requires its VERSION argument to be specified at dnl autoconf, not run, time. -case "${wxWITH_CXX-11}" in +case "${wxWITH_CXX-wxDEFAULT_CXXSTD}" in 11) + if test "$wxUSE_WEBVIEW_CHROMIUM" = "yes"; then + AC_MSG_ERROR([Using wxWebView Chromium backend requires C++14 or later.]) + fi + AX_CXX_COMPILE_STDCXX(11) ;;