mirror of https://github.com/encounter/SDL.git
cmake: check for math library functions even in the absence of libm
(Reference issue: https://github.com/libsdl-org/SDL/issues/7011)
This commit is contained in:
parent
75834df37c
commit
8e31fc4130
|
@ -1047,6 +1047,7 @@ if(SDL_LIBC)
|
||||||
check_library_exists(m pow "" HAVE_LIBM)
|
check_library_exists(m pow "" HAVE_LIBM)
|
||||||
if(HAVE_LIBM)
|
if(HAVE_LIBM)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES m)
|
set(CMAKE_REQUIRED_LIBRARIES m)
|
||||||
|
endif()
|
||||||
foreach(_FN
|
foreach(_FN
|
||||||
atan atan2 atanf atan2f ceil ceilf copysign copysignf cos cosf
|
atan atan2 atanf atan2f ceil ceilf copysign copysignf cos cosf
|
||||||
exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f
|
exp expf fabs fabsf floor floorf fmod fmodf log logf log10 log10f
|
||||||
|
@ -1056,6 +1057,7 @@ if(SDL_LIBC)
|
||||||
set(_HAVEVAR "HAVE_${_UPPER}")
|
set(_HAVEVAR "HAVE_${_UPPER}")
|
||||||
check_symbol_exists("${_FN}" "math.h" ${_HAVEVAR})
|
check_symbol_exists("${_FN}" "math.h" ${_HAVEVAR})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
if(HAVE_LIBM)
|
||||||
set(CMAKE_REQUIRED_LIBRARIES)
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
if(NOT VITA)
|
if(NOT VITA)
|
||||||
list(APPEND EXTRA_LIBS m)
|
list(APPEND EXTRA_LIBS m)
|
||||||
|
|
Loading…
Reference in New Issue