cmake: don't error on apple when using deprecated declarations
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
diff --git a/CMakeLists.txt b/CMakeLists.txt
index aba7bf9..4ace591 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -686,6 +686,14 @@ if(USE_GCC OR USE_CLANG)
endif()
if(APPLE)
+ cmake_push_check_state(RESET)
+ # FIXME: don't use deprecated declarations
+ check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
+ if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
+ target_compile_options(sdl-build-options INTERFACE "-Wno-error=deprecated-declarations")
+ endif()
+ cmake_pop_check_state()
+
# FIXME: use generator expression instead of appending to EXTRA_LDFLAGS_BUILD
list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-undefined,error")
list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}")
diff --git a/configure b/configure
index cf415a5..8e139dd 100755
--- a/configure
+++ b/configure
@@ -23001,8 +23001,8 @@ printf "%s\n" "$have_gcc_werror" >&6; }
CheckNoErrorDeprecatedDeclarationsWerror()
{
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Werror option" >&5
-printf %s "checking for GCC -Werror option... " >&6; }
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wno-error=deprecated-declarations option" >&5
+printf %s "checking for GCC -Wno-error=deprecated-declarations option... " >&6; }
have_gcc_no_werror_deprecated_declarations=no
save_CFLAGS="$CFLAGS"
diff --git a/configure.ac b/configure.ac
index 34942b0..2708c1f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1622,7 +1622,7 @@ CheckWerror()
dnl See if GCC's -Wno-error=deprecated-declarations is supported.
CheckNoErrorDeprecatedDeclarationsWerror()
{
- AC_MSG_CHECKING(for GCC -Werror option)
+ AC_MSG_CHECKING(for GCC -Wno-error=deprecated-declarations option)
have_gcc_no_werror_deprecated_declarations=no
save_CFLAGS="$CFLAGS"
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index d7c19f1..9f372bc 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -123,6 +123,13 @@ if(APPLE)
testnativecocoa.m
testnativex11.c
testutils.c)
+
+ cmake_push_check_state(RESET)
+ check_c_compiler_flag(-Wno-error=deprecated-declarations HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
+ cmake_pop_check_state()
+ if(HAVE_WNO_ERROR_DEPRECATED_DECLARATIONS)
+ set_property(SOURCE "testnativecocoa.m" APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-error=deprecated-declarations")
+ endif()
elseif(WINDOWS)
add_executable(testnative testnative.c testnativew32.c testutils.c)
elseif(HAVE_X11)
diff --git a/test/configure b/test/configure
index 8b7afb0..c71abe4 100755
--- a/test/configure
+++ b/test/configure
@@ -4790,8 +4790,8 @@ fi
case "$host" in
*-ios-*|*-*-darwin* )
- { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Werror option" >&5
-printf %s "checking for GCC -Werror option... " >&6; }
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wno-error=deprecated-declarations option" >&5
+printf %s "checking for GCC -Wno-error=deprecated-declarations option... " >&6; }
have_gcc_wno_error_deprecated_declarations=no
save_CFLAGS="$CFLAGS"
diff --git a/test/configure.ac b/test/configure.ac
index e0dd1c4..e989016 100644
--- a/test/configure.ac
+++ b/test/configure.ac
@@ -241,7 +241,7 @@ fi
case "$host" in
*-ios-*|*-*-darwin* )
- AC_MSG_CHECKING(for GCC -Werror option)
+ AC_MSG_CHECKING(for GCC -Wno-error=deprecated-declarations option)
have_gcc_wno_error_deprecated_declarations=no
save_CFLAGS="$CFLAGS"