[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: isnan() and isinf() checks
From:       Hasso Tepper <hasso () kde ! org>
Date:       2007-04-12 18:58:13
Message-ID: 200704122158.13611.hasso () kde ! org
[Download RAW message or body]

Alexander Neundorf wrote:
> Using "-lm" is no good idea, as Christian already stated.

Mkay. Better now?
 
> Please take a look at kdelibs/cmake/modules/MacroPushRequiredVars.cmake, it 
> offers two macros:
> 
> # Usage:
> # MACRO_PUSH_REQUIRED_VARS()
> # SET(CMAKE_REQUIRED_DEFINITIONS
>       ${CMAKE_REQUIRED_DEFINITIONS} -DSOME_MORE_DEF)
> # CHECK_FUNCTION_EXISTS(...)
> # MACRO_POP_REQUIRED_VARS()

Thanks for info.

> Can you please check whether check_symbol_exists() (from  
> Modules/CheckSymbolExists.cmake) does what you need instead of using 
> check_c_source_compiles() directly ?

Indeed. I didn't realise that it does work for macros as well. Updated
patch is attached.


regards,

-- 
Hasso Tepper
KDE Estonian Team

["kjs4-isnan-isinf.patch" (text/x-diff)]

Index: kjs/CMakeLists.txt
===================================================================
--- kjs/CMakeLists.txt	(revision 652998)
+++ kjs/CMakeLists.txt	(working copy)
@@ -10,10 +10,16 @@
 check_include_files(ieeefp.h      HAVE_IEEEFP_H)
 check_include_files("pthread.h;pthread_np.h" HAVE_PTHREAD_NP_H)
 check_include_files(valgrind/memcheck.h   HAVE_MEMCHECK_H)
+
+MACRO_PUSH_REQUIRED_VARS()
+if(NOT WIN32)
+    set(CMAKE_REQUIRED_LIBRARIES "-lm")
+endif(NOT WIN32)
 check_function_exists(_finite    HAVE_FUNC__FINITE)
 check_function_exists(finite     HAVE_FUNC_FINITE)
-check_function_exists(isinf      HAVE_FUNC_ISINF)
-check_function_exists(isnan      HAVE_FUNC_ISNAN)
+check_symbol_exists(isnan   "math.h" HAVE_FUNC_ISNAN)
+check_symbol_exists(isinf   "math.h" HAVE_FUNC_ISINF)
+MACRO_POP_REQUIRED_VARS()
 
 
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic