[LyX/master] Amend 39996524: Satisfy older cmake versions

Kornel Benko kornel at lyx.org
Fri Oct 23 10:58:21 UTC 2020


commit 6869c3adffe2d938faa457d0bd457ce38dcc8afb
Author: Kornel Benko <kornel at lyx.org>
Date:   Fri Oct 23 13:25:49 2020 +0200

    Amend 39996524: Satisfy older cmake versions
---
 CMakeLists.txt                                    |   15 +++++++++++----
 development/cmake/modules/FindCXX11Compiler.cmake |    1 +
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3840cc9..3e5c613 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -699,15 +699,22 @@ else()
 	  # Try to find a std-cxx-feature supported by this cmake version
 	  while (std_num GREATER 0)
 	    list(FIND CMAKE_CXX_COMPILE_FEATURES "cxx_std_${std_num}" stdfeature)
-	    if (stdfeature GREATER_EQUAL 0)
+	    if (stdfeature GREATER -1)
 	      set(CMAKE_CXX_STANDARD ${std_num})
 	      break()
 	    endif()
 	    math(EXPR std_num "${std_num}-1")
 	  endwhile()
-
-	  message(STATUS "CMAKE_CXX_STANDARD set to ${CMAKE_CXX_STANDARD}")
-	  set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_CXX_FLAGS}")
+	  message(STATUS "std_num = ${std_num}")
+	  if (std_num EQUAL 0)
+	    # not found appropriate feature
+	    # so we use LYX_GCC11_MODE
+	    set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_GCC11_MODE}${LYX_CXX_FLAGS}")
+	  else()
+	    message(STATUS "CMAKE_CXX_STANDARD set to ${CMAKE_CXX_STANDARD}")
+	    set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_CXX_FLAGS}")
+	  endif()
+	  message(STATUS "Setting LYX_CXX_FLAGS to ${LYX_CXX_FLAGS}")
 	else()
 	  set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_GCC11_MODE}${LYX_CXX_FLAGS}")
 	endif()
diff --git a/development/cmake/modules/FindCXX11Compiler.cmake b/development/cmake/modules/FindCXX11Compiler.cmake
index 96b72eb..7f22f59 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++20"
         "--std=c++17"
         "--std=c++14"
         "--std=c++11"


More information about the lyx-cvs mailing list