cmake: fall back to -Wconversion if -Wfloat-conversion isn't available

... during checks for valid isinf/isinff/isnan/isnanf macros.

(cherry picked from commit 98bed62259)
This commit is contained in:
Ozkan Sezer
2025-08-27 21:33:55 +03:00
parent 16c0329a2a
commit 611940fb80

View File

@@ -1060,8 +1060,10 @@ if(SDL_LIBC)
cmake_push_check_state()
if(MSVC)
string(APPEND CMAKE_REQUIRED_FLAGS " -we4244 -WX") # 'conversion' conversion from 'type1' to 'type2', possible loss of data
else()
elseif(HAVE_GCC_WFLOAT_CONVERSION)
string(APPEND CMAKE_REQUIRED_FLAGS " -Wfloat-conversion -Werror")
else()
string(APPEND CMAKE_REQUIRED_FLAGS " -Wconversion -Werror")
endif()
foreach(math_fn isinf isnan)
string(TOUPPER "${math_fn}" MATH_FN)