cmake: add -Wno-declaration-after-statement to cpu-features.c alone

main
Anonymous Maarten 2022-09-27 17:33:49 +02:00 committed by Sam Lantinga
parent 7becbd7d42
commit a193a03d81
1 changed files with 7 additions and 10 deletions

View File

@ -602,17 +602,13 @@ if(USE_GCC OR USE_CLANG)
list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing") list(APPEND EXTRA_CFLAGS "-fno-strict-aliasing")
endif() endif()
# Android needs to bring in external files that don't adhere to the declaration-after-statement check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
# warning, so skip this warning on Android. if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT)
if(NOT ANDROID) check_c_compiler_flag(-Werror=declaration-after-statement HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
check_c_compiler_flag(-Wdeclaration-after-statement HAVE_GCC_WDECLARATION_AFTER_STATEMENT) if(HAVE_GCC_WERROR_DECLARATION_AFTER_STATEMENT)
if(HAVE_GCC_WDECLARATION_AFTER_STATEMENT) list(APPEND EXTRA_CFLAGS "-Werror=declaration-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() endif()
list(APPEND EXTRA_CFLAGS "-Wdeclaration-after-statement")
endif() endif()
if(DEPENDENCY_TRACKING) if(DEPENDENCY_TRACKING)
@ -1129,6 +1125,7 @@ endif()
if(ANDROID) if(ANDROID)
file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c) 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) 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) if(SDL_MISC)
file(GLOB ANDROID_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/android/*.c) file(GLOB ANDROID_MISC_SOURCES ${SDL2_SOURCE_DIR}/src/misc/android/*.c)