Cmake build: Omit use -f '-Wno-deprecated-copy' on compilers which do not support this flag.

Patch from P. De Visschere

Citing Patrick: As is stands the patch unsets the test-variable
from the cache and the test is performed for each cmake-run.
Otherwise after running cmake once the check is never run again, until
one throws away the cmakecache.txt, which I try to avoid.
I suppose that after time this check will be forgotten and if the issue
is solved (by an upgrade of the Apple clang compiler) this will pass
unnoticed.
This commit is contained in:
Kornel Benko 2021-04-05 11:14:13 +02:00
parent eb2e8e1579
commit fa704d50f7

View File

@ -699,7 +699,14 @@ else()
# The following setting with LYX_GCC11_MODE is needed because cmake does not honor
# CMAKE_CXX_STANDARD while performing tests like
# check_cxx_source_compiles("..." HAVE_DEF_MAKE_UNIQUE)
set(LYX_CXX_FLAGS "-Wall -Wextra -Wno-deprecated-copy ${LYX_GCC11_MODE}${LYX_CXX_FLAGS}")
include(CheckCXXCompilerFlag)
unset(CHECK_WNODEPRECATEDCOPY_FLAG CACHE)
CHECK_CXX_COMPILER_FLAG("-Wno-deprecated-copy" CHECK_WNODEPRECATEDCOPY_FLAG)
if(${CHECK_WNODEPRECATEDCOPY_FLAG})
set(LYX_CXX_FLAGS "-Wall -Wextra -Wno-deprecated-copy ${LYX_GCC11_MODE}${LYX_CXX_FLAGS}")
else()
set(LYX_CXX_FLAGS "-Wall -Wextra ${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")
else()