Hi Alan,

>
> IF("${VARIABLE}" MATCHES "^${VARIABLE}$")
>
> Is CMake-2.2 (or so) logic which I never understood either, but from
> explanations I got years ago on the CMake mailing list it works on all
> versions of CMake just like the more modern
>
> IF(NOT DEFINED VARIABLE)
>
> which is true if the variable has not been set at all, but false  
> otherwise
> (even if the variable has been set to "").  So reusing the HAVE_FINITE
> variable the way you propose above just won't work.
>
>
>
> I suggest you drop all re-use of variables for the reasons I  
> mentioned to
> produce a reliable result in all cases (not just the ones you have  
> tested
> so far).
>
> So I suggest this version which stores the result in the uncached  
> variable
> HAVE_FINITE with everything else in cached variables which are  
> marked as
> advanced.  (This follows the suggestion for the best way to return  
> results
> from CMake modules.)
>
> check_symbol_exists(finite "math.h" HAVE_FINITE_SYMBOL)
> if(HAVE_FINITE_SYMBOL)
>   set(HAVE_FINITE ON)
> else(HAVE_FINITE_SYMBOL)
>   check_function_exists(finite HAVE_FINITE_FUNCTION)
>   if(HAVE_FINITE_FUNCTION)
>     set(HAVE_FINITE ON)
>   else(HAVE_FINITE_FUNCTION)
>     check_symbol_exists(_finite "math.h" HAVE__FINITE_SYMBOL)
>     if(HAVE__FINITE_SYMBOL)
>       set(HAVE_FINITE ON)
>     else(HAVE__FINITE_SYMBOL)
>       check_function_exists(_finite "math.h" HAVE__FINITE_FUNCTION)
>       if(HAVE__FINITE_FUNCTION)
>               set(HAVE_FINITE ON)
>       endif(HAVE__FINITE_FUNCTION)
>     endif(HAVE__FINITE_SYMBOL)
>   endif(HAVE_FINITE_FUNCTION)
> endif(NOT HAVE_FINITE_SYMBOL)
>
> mark_as_advanced(
>   HAVE_FINITE_SYMBOL
>   HAVE_FINITE_FUNCTION
>   HAVE__FINITE_SYMBOL
>   HAVE__FINITE_FUNCTION
>   )

I have more or less implemented it as you suggested. I didn't marked  
the variables as advanced since they are INTERNAL CACHE anyway, so  
they don't show up for the cmake-gui.

I hope this is now okay ;)

Thanks for your help,
Werner

>
> Note, I have not checked this completely so there might be a typo in  
> there,
> but The above logic has clean flow which I presume most CMake users  
> can
> understand at a glance.  It follows the rule there is no re-use of
> check_function/symbol_exists variables for other purposes, and  
> HAVE_FINITE
> gets set properly (or not at all if no alternative works) the first  
> time. On
> subsequent times HAVE_FINITE gets set quite rapidly from the cached  
> values
> of the advanced variables since the search is skipped entirely inside
> check_????_exists and the existing cached value of the unique  
> variable left
> untouched, instead.
>
> HTH.
>
> Alan
> __________________________
> Alan W. Irwin
>
> Astronomical research affiliation with Department of Physics and  
> Astronomy,
> University of Victoria (astrowww.phys.uvic.ca).
>
> Programming affiliations with the FreeEOS equation-of-state  
> implementation
> for stellar interiors (freeeos.sf.net); PLplot scientific plotting  
> software
> package (plplot.org); the libLASi project (unifont.org/lasi); the  
> Loads of
> Linux Links project (loll.sf.net); and the Linux Brochure Project
> (lbproject.sf.net).
> __________________________
>
> Linux-powered Science
> __________________________
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San  
> Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the  
> Enterprise
> -Strategies to boost innovation and cut costs with open source  
> participation
> -Receive a $600 discount off the registration fee with the source  
> code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Plplot-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/plplot-devel

--
Dr. Werner Smekal
Institut fuer Allgemeine Physik
Technische Universitaet Wien
Wiedner Hauptstr 8-10
A-1040 Wien
Austria

email: [email protected]
web: http://www.iap.tuwien.ac.at/~smekal
phone: +43-(0)1-58801-13463 (office), +43-(0)1-58801-13469 (laboratory)
fax: +43-(0)1-58801-13499


------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Plplot-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to