Amend 39996524: Satisfy older cmake versions

This commit is contained in:
Kornel Benko 2020-10-23 13:25:49 +02:00
parent afdda7c9e1
commit 6869c3adff
2 changed files with 12 additions and 4 deletions

View File

@ -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()

View File

@ -54,6 +54,7 @@ else()
endif()
else()
set(CXX11_FLAG_CANDIDATES
"--std=c++20"
"--std=c++17"
"--std=c++14"
"--std=c++11"