cmake: don't use target_compile_features when the CMake thinks the compiler does not support it

This happens when using an older CMake with a new LLVM toolchain (e.g. Android ndk)
This commit is contained in:
Anonymous Maarten 2024-02-21 00:51:40 +01:00
parent cbf0b1ce81
commit 7eca84d57e
1 changed files with 10 additions and 2 deletions

View File

@ -372,14 +372,22 @@ if(SDL_SHARED)
add_library(SDL3-shared SHARED)
add_library(SDL3::SDL3-shared ALIAS SDL3-shared)
SDL_AddCommonCompilerFlags(SDL3-shared)
target_compile_features(SDL3-shared PRIVATE c_std_99)
if ("c_std_99" IN_LIST CMAKE_C_COMPILE_FEATURES)
target_compile_features(SDL3-shared PRIVATE c_std_99)
else()
message(WARNING "target_compile_features does not know c_std_99 for C compiler")
endif()
endif()
if(SDL_STATIC)
add_library(SDL3-static STATIC)
add_library(SDL3::SDL3-static ALIAS SDL3-static)
SDL_AddCommonCompilerFlags(SDL3-static)
target_compile_features(SDL3-static PRIVATE c_std_99)
if ("c_std_99" IN_LIST CMAKE_C_COMPILE_FEATURES)
target_compile_features(SDL3-static PRIVATE c_std_99)
else()
message(WARNING "target_compile_features does not know c_std_99 for C compiler")
endif()
endif()
if(SDL_TEST_LIBRARY)