commit fa704d50f70e2ead66f34594023aebb50714926c
Author: Kornel Benko <kor...@lyx.org>
Date:   Mon Apr 5 11:14:13 2021 +0200

    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.
---
 CMakeLists.txt |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e4ed8cf..c3eed1a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -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()
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to