From bfeeaeabd7bcbbba6e97bd470c9667085e79333a Mon Sep 17 00:00:00 2001 From: Sylvain Beucler Date: Wed, 2 May 2012 16:44:40 +0000 Subject: [PATCH] CHECK_FUNCTION_EXISTS for sinf/cosf/sqrtf actually fails not because of missing math.h, but because of missing -lm. Fixed. git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@1281 7f0cb862-5218-0410-a997-914c9d46530a --- CMakeLists.txt | 26 ++++++-------------------- 1 file changed, 6 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 83e5d31..3068986 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,7 +187,10 @@ ENDIF() # lib m for math, not needed on windows IF (NOT WIN32) + # For compilation: LIST(APPEND LIBS m) + # For CHECK_FUNCTION_EXISTS: + LIST(APPEND CMAKE_REQUIRED_LIBRARIES m) ENDIF() IF(WIN32) @@ -262,26 +265,9 @@ IF (NOT (HAVE_STDINT_H OR HAVE_INTTYPES_H)) ENDIF() # Check for sinf/cosf/sqrtf -# CHECK_FUNCTION_EXISTS doesn't work because check requires -#CHECK_FUNCTION_EXISTS(sinf HAVE_SINF) -#CHECK_FUNCTION_EXISTS(cosf HAVE_COSF) -#CHECK_FUNCTION_EXISTS(sqrtf HAVE_SQRTF) -INCLUDE(CheckCSourceCompiles) -CHECK_C_SOURCE_COMPILES(" - #include - int main(){sinf(0); return 0;} - " HAVE_SINF -) -CHECK_C_SOURCE_COMPILES(" - #include - int main(){cosf(0); return 0;} - " HAVE_COSF -) -CHECK_C_SOURCE_COMPILES(" - #include - int main(){sqrtf(0); return 0;} - " HAVE_SQRTF -) +CHECK_FUNCTION_EXISTS(sinf HAVE_SINF) +CHECK_FUNCTION_EXISTS(cosf HAVE_COSF) +CHECK_FUNCTION_EXISTS(sqrtf HAVE_SQRTF) # The generated config.h is placed in the project's build directory, just to # ensure that all CMake-generated files are kept away from the main source tree. -- 1.7.10.4