[LyX/master] Cmake build: Next try to use of '--std=c++17' for gnu compiler"

Kornel Benko kornel at lyx.org
Thu Oct 22 11:23:51 UTC 2020


commit d954a6b09cc9d284a34510f076c16f22b425ead2
Author: Kornel Benko <kornel at lyx.org>
Date:   Thu Oct 22 13:46:29 2020 +0200

    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 9085355..42b7399 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 <brad.king at kitware.com>
 	  # 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 9188ab6..96b72eb 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"


More information about the lyx-cvs mailing list