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)
This commit is contained in:
Mahmoud Al-Qudsi 2020-07-04 21:13:28 -05:00
parent e628ba51e7
commit fe2da0a94f
2 changed files with 6 additions and 2 deletions

View File

@ -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.

View File

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