Pārlūkot izejas kodu

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

Anonymous Maarten 2 gadi atpakaļ
vecāks
revīzija
45da133999
6 mainītis faili ar 21 papildinājumiem un 6 dzēšanām
  1. 8 0
      CMakeLists.txt
  2. 2 2
      configure
  3. 1 1
      configure.ac
  4. 7 0
      test/CMakeLists.txt
  5. 2 2
      test/configure
  6. 1 1
      test/configure.ac

+ 8 - 0
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}")

+ 2 - 2
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"

+ 1 - 1
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"

+ 7 - 0
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)

+ 2 - 2
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"

+ 1 - 1
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"