From fe2da0a94f2d23387163081e1270f2954ef79a1d Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Sat, 4 Jul 2020 21:13:28 -0500 Subject: [PATCH] Put -Wno-redundant-move behind a compiler check This fixes a warning under Ubuntu 18.04's default gcc (cc++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0) --- CMakeLists.txt | 1 - cmake/ConfigureChecks.cmake | 7 ++++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d0430429..3888cfce6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,6 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra \ -Wno-comment \ -Wno-address \ -Wno-strict-aliasing \ --Wno-redundant-move \ ") # Disable exception handling. diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 1b003add6..02943124c 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -4,15 +4,20 @@ # `wcstod_l` is a GNU-extension, sometimes hidden behind GNU-related defines. # This is the case for at least Cygwin and Newlib. list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE=1) +include(CheckCXXCompilerFlag) if(APPLE) - include(CheckCXXCompilerFlag) check_cxx_compiler_flag("-Werror=unguarded-availability" REQUIRES_UNGUARDED_AVAILABILITY) if(REQUIRES_UNGUARDED_AVAILABILITY) list(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Werror=unguarded-availability") endif() endif() +check_cxx_compiler_flag("-Wno-redundant-move" HAS_NO_REDUNDANT_MOVE) +if (HAS_NO_REDUNDANT_MOVE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-redundant-move") +endif() + # Try using CMake's own logic to locate curses/ncurses find_package(Curses) if(NOT ${CURSES_FOUND})