cmake: add -Wno-declaration-after-statement to cpu-features.c alone
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4f06224..30a224c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -602,17 +602,13 @@ if(USE_GCC OR USE_CLANG)
list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing")
endif()
- # Android needs to bring in external files that don't adhere to the declaration-after-statement
- # warning, so skip this warning on Android.
- if(NOT ANDROID)
- check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
- if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
- check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
- if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
- list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement")
- endif()
- list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement")
+ check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
+ if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
+ check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
+ if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
+ list(APPEND EXTRA_CFLAGS "-Werror=declaration-after-statement")
endif()
+ list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement")
endif()
if(DEPENDENCY_TRACKING)
@@ -1129,6 +1125,7 @@ endif()
if(ANDROID)
file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c)
list(APPEND SOURCE_FILES ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
+ set_property(SOURCE "${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c" APPEND_STRING PROPERTY COMPILE_FLAGS " -Wno-declaration-after-statement")
if(SDL_MISC)
file(GLOB ANDROID_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/android/*.c)