CMake: Check if we need libm for round()

Fixes: https://github.com/awesomeWM/awesome/issues/969
Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2016-07-05 21:41:49 +02:00
parent a99bfd534c
commit dc0a337aea
1 changed files with 14 additions and 0 deletions

View File

@ -199,6 +199,20 @@ else()
message(STATUS "checking for execinfo -- not found")
endif()
# Do we need libm for round()?
check_function_exists(round HAS_ROUND_WITHOUT_LIBM)
if(NOT HAS_ROUND_WITHOUT_LIBM)
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
set(AWESOME_REQUIRED_LDFLAGS ${AWESOME_REQUIRED_LDFLAGS} m)
check_function_exists(round HAS_ROUND_WITH_LIBM)
if(NOT HAS_ROUND_WITH_LIBM)
message(FATAL_ERROR "Did not find round()")
endif()
message(STATUS "checking for round -- in libm")
else()
message(STATUS "checking for round -- builtin")
endif()
set(AWESOME_REQUIRED_LDFLAGS
${AWESOME_COMMON_REQUIRED_LDFLAGS}
${AWESOME_REQUIRED_LDFLAGS}