From 16a94db7020eb1bf0e1c9637923401cda9bb125e Mon Sep 17 00:00:00 2001 From: Mahmoud Al-Qudsi Date: Thu, 10 Jan 2019 19:53:33 -0600 Subject: [PATCH] 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. --- cmake/ConfigureChecks.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index ef48f90ae..c53be74ae 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -5,8 +5,11 @@ # This is the case for at least Cygwin and Newlib. LIST(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE=1) IF(APPLE) - # 10.7+ only. - LIST(APPEND CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Werror=unguarded-availability") + 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() # Try using CMake's own logic to locate curses/ncurses