aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-09-24 00:42:14 -0700
committerChris Robinson <[email protected]>2011-09-24 00:42:14 -0700
commitdeef98658ba65ea547ad440f20889273715d17fd (patch)
tree76841787e2709b14390165eb9cdf45222d813e6c
parentd9544d006ba792b32e2fa9abaec62730eca13429 (diff)
Don't require libm for the float-type math functions
-rw-r--r--CMakeLists.txt31
1 files changed, 19 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4909a985..89762164 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -223,20 +223,27 @@ IF(NOT HAVE_GUIDDEF_H)
ENDIF()
CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H)
-CHECK_LIBRARY_EXISTS(m powf "" HAVE_POWF)
-CHECK_LIBRARY_EXISTS(m sqrtf "" HAVE_SQRTF)
-CHECK_LIBRARY_EXISTS(m cosf "" HAVE_COSF)
-CHECK_LIBRARY_EXISTS(m sinf "" HAVE_SINF)
-CHECK_LIBRARY_EXISTS(m acosf "" HAVE_ACOSF)
-CHECK_LIBRARY_EXISTS(m asinf "" HAVE_ASINF)
-CHECK_LIBRARY_EXISTS(m atanf "" HAVE_ATANF)
-CHECK_LIBRARY_EXISTS(m fabsf "" HAVE_FABSF)
-IF(HAVE_FENV_H)
- CHECK_LIBRARY_EXISTS(m fesetround "" HAVE_FESETROUND)
-ENDIF()
-IF(HAVE_SQRTF OR HAVE_COSF OR HAVE_SINF OR HAVE_ACOSF OR HAVE_ASINF OR HAVE_ATANF OR HAVE_FABSF OR HAVE_FESETROUND)
+# Some systems need libm for some of the following math functions to work
+CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM)
+IF(HAVE_LIBM)
SET(EXTRA_LIBS m ${EXTRA_LIBS})
+ SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m)
+ENDIF()
+
+
+CHECK_SYMBOL_EXISTS(powf math.h HAVE_POWF)
+CHECK_SYMBOL_EXISTS(sqrtf math.h HAVE_SQRTF)
+CHECK_SYMBOL_EXISTS(cosf math.h HAVE_COSF)
+CHECK_SYMBOL_EXISTS(sinf math.h HAVE_SINF)
+CHECK_SYMBOL_EXISTS(acosf math.h HAVE_ACOSF)
+CHECK_SYMBOL_EXISTS(asinf math.h HAVE_ASINF)
+CHECK_SYMBOL_EXISTS(atanf math.h HAVE_ATANF)
+CHECK_SYMBOL_EXISTS(fabsf math.h HAVE_FABSF)
+
+IF(HAVE_FENV_H)
+ CHECK_SYMBOL_EXISTS(fesetround fenv.h HAVE_FESETROUND)
ENDIF()
+
CHECK_FUNCTION_EXISTS(strtof HAVE_STRTOF)
CHECK_FUNCTION_EXISTS(_controlfp HAVE__CONTROLFP)