From 112208ddd9c862d2788f28dadf8ac7073f1553eb Mon Sep 17 00:00:00 2001 From: Kornel Benko Date: Thu, 24 Oct 2024 11:35:06 +0200 Subject: [PATCH] Amend c916bd15 for cmake build: Require C++17 --- development/cmake/modules/FindCXX11Compiler.cmake | 3 ++- development/cmake/modules/LyXMacros.cmake | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/development/cmake/modules/FindCXX11Compiler.cmake b/development/cmake/modules/FindCXX11Compiler.cmake index 750a8ff32b..ddab3a2335 100644 --- a/development/cmake/modules/FindCXX11Compiler.cmake +++ b/development/cmake/modules/FindCXX11Compiler.cmake @@ -38,7 +38,8 @@ INCLUDE(FindPackageHandleStandardArgs) # Detection of c++20 works well, but our code is not ready for it yet. # We currently get errors with internal boost and also from our code. set(_max_std_num 20) -lyxgetknowncmakestd(${_max_std_num} tmpnums) +set(_min_std_num 17) +lyxgetknowncmakestd(${_max_std_num} ${_min_std_num} tmpnums) if (CMAKE_CXX_COMPILER_ID MATCHES "^([cC]lang|AppleClang)$") foreach(_num ${tmpnums}) diff --git a/development/cmake/modules/LyXMacros.cmake b/development/cmake/modules/LyXMacros.cmake index 045a63f31a..16b95c4ef2 100644 --- a/development/cmake/modules/LyXMacros.cmake +++ b/development/cmake/modules/LyXMacros.cmake @@ -468,12 +468,12 @@ function(determineversionandbuildtype configfile package version dirs date build endfunction(determineversionandbuildtype) # determine known cmake cxx_std features but only if not greater than ${max_desired} -function(lyxgetknowncmakestd max_desired result) +function(lyxgetknowncmakestd max_desired min_enabled result) set(tmp_list) set(CXX_STD_LIST) math(EXPR max_desired "${max_desired}+1") if (CMAKE_VERSION VERSION_LESS "3.9") - list(APPEND tmp_list 98 11 14) + list(APPEND tmp_list 14 17 20) else() foreach(_e ${CMAKE_CXX_COMPILE_FEATURES}) if (_e MATCHES "^cxx_std_\(.*)") @@ -484,7 +484,7 @@ function(lyxgetknowncmakestd max_desired result) list(REVERSE tmp_list) # Filter undesired from list foreach(i ${tmp_list}) - if (i LESS ${max_desired} OR i GREATER 89) + if (i LESS ${max_desired} AND i GREATER_EQUAL ${min_enabled}) list(APPEND CXX_STD_LIST ${i}) endif() endforeach()