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
This commit is contained in:
Kornel Benko 2020-10-22 13:46:29 +02:00
parent d3c16d0496
commit d954a6b09c
2 changed files with 5 additions and 2 deletions

View File

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

View File

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