From d954a6b09cc9d284a34510f076c16f22b425ead2 Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Thu, 22 Oct 2020 13:46:29 +0200 Subject: [PATCH] Cmake build: Next try to use of '--std=c++17' for gnu compiler" Setting CMAKE_CXX_STANDARD explicitly, so that cmake can use correct cxx-flags --- CMakeLists.txt | 6 ++++-- development/cmake/modules/FindCXX11Compiler.cmake | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90853559a8..42b7399c26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -692,14 +692,16 @@ else() if(NOT LYX_QUIET) set(CMAKE_VERBOSE_MAKEFILE ON) endif() - set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_GCC11_MODE}${LYX_CXX_FLAGS}") - if(LYX_GCC11_MODE MATCHES "\\+\\+(14|11|98)") + if(LYX_GCC11_MODE MATCHES "\\+\\+([0-9][0-9])") # Thanks to Brad King # for the pointer to https://cmake.org/cmake/help/v3.6/variable/CMAKE_CXX_STANDARD.html # This allows us to use QT5.7 with recent g++ (version >= 4.9) compilers # and still use our own c++ extension tests set(CMAKE_CXX_STANDARD ${CMAKE_MATCH_1}) message(STATUS "CMAKE_CXX_STANDARD set to ${CMAKE_CXX_STANDARD}") + set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_CXX_FLAGS}") + else() + set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_GCC11_MODE}${LYX_CXX_FLAGS}") endif() if(LYX_STDLIB_DEBUG) set(LYX_CXX_FLAGS "${LYX_CXX_FLAGS} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC") diff --git a/development/cmake/modules/FindCXX11Compiler.cmake b/development/cmake/modules/FindCXX11Compiler.cmake index 9188ab6f5b..96b72eb33f 100644 --- a/development/cmake/modules/FindCXX11Compiler.cmake +++ b/development/cmake/modules/FindCXX11Compiler.cmake @@ -54,6 +54,7 @@ else() endif() else() set(CXX11_FLAG_CANDIDATES + "--std=c++17" "--std=c++14" "--std=c++11" "--std=gnu++11"