Check for -Werror=unguarded_availability support before forcing it

The compiler flag `-Werror=unguarded_availability` was hard-coded for
macOS, but is not supported by GCC on macOS 10.10 (Yosemite). Test for
support with CHECK_CXX_COMPILER_FLAG before forcing it.
This commit is contained in:
Mahmoud Al-Qudsi 2019-01-10 19:53:33 -06:00
parent 2bb53f7253
commit 16a94db702

View file

@ -5,9 +5,12 @@
# This is the case for at least Cygwin and Newlib. # This is the case for at least Cygwin and Newlib.
LIST(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE=1) LIST(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE=1)
IF(APPLE) IF(APPLE)
# 10.7+ only. 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") LIST(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Werror=unguarded-availability")
ENDIF() ENDIF()
ENDIF()
# Try using CMake's own logic to locate curses/ncurses # Try using CMake's own logic to locate curses/ncurses
FIND_PACKAGE(Curses) FIND_PACKAGE(Curses)