cmake: don't error on apple when using deprecated declarations

main
Anonymous Maarten 2022-10-06 00:39:47 +02:00 committed by Anonymous Maarten
parent 274ec02581
commit 45da133999
6 changed files with 21 additions and 6 deletions

View File

@ -686,6 +686,14 @@ if(USE_GCC OR USE_CLANG)
endif() endif()
if(APPLE) 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 # 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,-undefined,error")
list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}") list(APPEND EXTRA_LDFLAGS_BUILD "-Wl,-compatibility_version,${DYLIB_COMPATIBILITY_VERSION}")

4
configure vendored
View File

@ -23001,8 +23001,8 @@ printf "%s\n" "$have_gcc_werror" >&6; }
CheckNoErrorDeprecatedDeclarationsWerror() CheckNoErrorDeprecatedDeclarationsWerror()
{ {
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Werror option" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wno-error=deprecated-declarations option" >&5
printf %s "checking for GCC -Werror option... " >&6; } printf %s "checking for GCC -Wno-error=deprecated-declarations option... " >&6; }
have_gcc_no_werror_deprecated_declarations=no have_gcc_no_werror_deprecated_declarations=no
save_CFLAGS="$CFLAGS" save_CFLAGS="$CFLAGS"

View File

@ -1622,7 +1622,7 @@ CheckWerror()
dnl See if GCC's -Wno-error=deprecated-declarations is supported. dnl See if GCC's -Wno-error=deprecated-declarations is supported.
CheckNoErrorDeprecatedDeclarationsWerror() 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 have_gcc_no_werror_deprecated_declarations=no
save_CFLAGS="$CFLAGS" save_CFLAGS="$CFLAGS"

View File

@ -123,6 +123,13 @@ if(APPLE)
testnativecocoa.m testnativecocoa.m
testnativex11.c testnativex11.c
testutils.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) elseif(WINDOWS)
add_executable(testnative testnative.c testnativew32.c testutils.c) add_executable(testnative testnative.c testnativew32.c testutils.c)
elseif(HAVE_X11) elseif(HAVE_X11)

4
test/configure vendored
View File

@ -4790,8 +4790,8 @@ fi
case "$host" in case "$host" in
*-ios-*|*-*-darwin* ) *-ios-*|*-*-darwin* )
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Werror option" >&5 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for GCC -Wno-error=deprecated-declarations option" >&5
printf %s "checking for GCC -Werror option... " >&6; } printf %s "checking for GCC -Wno-error=deprecated-declarations option... " >&6; }
have_gcc_wno_error_deprecated_declarations=no have_gcc_wno_error_deprecated_declarations=no
save_CFLAGS="$CFLAGS" save_CFLAGS="$CFLAGS"

View File

@ -241,7 +241,7 @@ fi
case "$host" in case "$host" in
*-ios-*|*-*-darwin* ) *-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 have_gcc_wno_error_deprecated_declarations=no
save_CFLAGS="$CFLAGS" save_CFLAGS="$CFLAGS"