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 # Try to find a std-cxx-feature supported by this cmake version
while (std_num GREATER 0) while (std_num GREATER 0)
list(FIND CMAKE_CXX_COMPILE_FEATURES "cxx_std_${std_num}" stdfeature) 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}) set(CMAKE_CXX_STANDARD ${std_num})
break() break()
endif() endif()
math(EXPR std_num "${std_num}-1") math(EXPR std_num "${std_num}-1")
endwhile() endwhile()
message(STATUS "std_num = ${std_num}")
message(STATUS "CMAKE_CXX_STANDARD set to ${CMAKE_CXX_STANDARD}") if (std_num EQUAL 0)
set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_CXX_FLAGS}") # 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() else()
set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_GCC11_MODE}${LYX_CXX_FLAGS}") set(LYX_CXX_FLAGS "-Wall -Wunused-parameter ${LYX_GCC11_MODE}${LYX_CXX_FLAGS}")
endif() endif()

View File

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