[cmake,android] check compiler flags

Check -mfloat-abi=softfp supported before use. This workaround is for
older NDK versions that do not properly set this in the toolchain file.
Newer NDK versions changed compiler no longer supporting that flag.
This commit is contained in:
akallabeth 2024-08-29 09:25:00 +02:00
parent 7503efed27
commit 1e24fcd9a4
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5

View File

@ -422,8 +422,13 @@ if(ANDROID)
endif()
if(ANDROID_ABI STREQUAL arm64-v8a)
# https://github.com/android/ndk/issues/910
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=softfp")
include (CheckCCompilerFlag)
check_c_compiler_flag("-mfloat-abi=softfp" ABI_SOFTFP_SUPPORTED)
if (ABI_SOFTFP_SUPPORTED)
# https://github.com/android/ndk/issues/910
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfloat-abi=softfp")
endif()
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")