Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Werner Smekal <smekal@ia...>  20090226 20:20:16

Hi Alan and Andrew, in plplot.cmake we determine if finite/isnan/isinf or _finite/_isnan/_isinf is available with such code check_symbol_exists(finite "math.h" HAVE_FINITE) if(NOT HAVE_FINITE) check_function_exists(finite HAVE_FINITE2) endif(NOT HAVE_FINITE) set(HAVE_FINITE ${HAVE_FINITE2}) if(NOT HAVE_FINITE) check_symbol_exists(_finite "math.h" _HAVE_FINITE) if(NOT _HAVE_FINITE) check_function_exists(_finite _HAVE_FINITE2) endif(NOT _HAVE_FINITE) set(_HAVE_FINITE ${_HAVE_FINITE2}) set(HAVE_FINITE ${_HAVE_FINITE} CACHE INTERNAL "Have function _finite") endif(NOT HAVE_FINITE) It works fine, but if there is some change to the cmake files, cmake runs again even if I only run nmake (which is ok). But during this configuration cmake "forgets" about the _HAVE_FINITE variable and also doesn't test anymore for it. So for Visual C++, where _HAVE_FINITE is set, the second run doesn't compile anymore  I have to delete the directory and reconfigure, which is quite annoying. I'm not quite sure why HAVE_FINITE is internally cached and set to ${_HAVE_FINITE} (?) and also only if finite wasn't found  so if finite is found, HAVE_FINITE is not in the cache, or? Anyway, do you both can help me to solve this problem, since I'm not sure how to proceed. Thanks, Werner  Dr. Werner Smekal Institut fuer Allgemeine Physik Technische Universitaet Wien Wiedner Hauptstr 810 A1040 Wien Austria DVRNr: 0005886 email: smekal@... web: http://www.iap.tuwien.ac.at/~smekal phone: +43(0)15880113463 (office) +43(0)15880113469 (laboratory) fax: +43(0)15880113499 
From: Werner Smekal <smekal@ia...>  20090226 20:20:16

Hi Alan and Andrew, in plplot.cmake we determine if finite/isnan/isinf or _finite/_isnan/_isinf is available with such code check_symbol_exists(finite "math.h" HAVE_FINITE) if(NOT HAVE_FINITE) check_function_exists(finite HAVE_FINITE2) endif(NOT HAVE_FINITE) set(HAVE_FINITE ${HAVE_FINITE2}) if(NOT HAVE_FINITE) check_symbol_exists(_finite "math.h" _HAVE_FINITE) if(NOT _HAVE_FINITE) check_function_exists(_finite _HAVE_FINITE2) endif(NOT _HAVE_FINITE) set(_HAVE_FINITE ${_HAVE_FINITE2}) set(HAVE_FINITE ${_HAVE_FINITE} CACHE INTERNAL "Have function _finite") endif(NOT HAVE_FINITE) It works fine, but if there is some change to the cmake files, cmake runs again even if I only run nmake (which is ok). But during this configuration cmake "forgets" about the _HAVE_FINITE variable and also doesn't test anymore for it. So for Visual C++, where _HAVE_FINITE is set, the second run doesn't compile anymore  I have to delete the directory and reconfigure, which is quite annoying. I'm not quite sure why HAVE_FINITE is internally cached and set to ${_HAVE_FINITE} (?) and also only if finite wasn't found  so if finite is found, HAVE_FINITE is not in the cache, or? Anyway, do you both can help me to solve this problem, since I'm not sure how to proceed. Thanks, Werner  Dr. Werner Smekal Institut fuer Allgemeine Physik Technische Universitaet Wien Wiedner Hauptstr 810 A1040 Wien Austria DVRNr: 0005886 email: smekal@... web: http://www.iap.tuwien.ac.at/~smekal phone: +43(0)15880113463 (office) +43(0)15880113469 (laboratory) fax: +43(0)15880113499 
From: Alan W. Irwin <irwin@be...>  20090226 23:28:58

On 20090226 21:20+0100 Werner Smekal wrote: > Hi Alan and Andrew, > > in plplot.cmake we determine if finite/isnan/isinf or > _finite/_isnan/_isinf is available with such code > > check_symbol_exists(finite "math.h" HAVE_FINITE) > if(NOT HAVE_FINITE) > check_function_exists(finite HAVE_FINITE2) > endif(NOT HAVE_FINITE) > set(HAVE_FINITE ${HAVE_FINITE2}) > if(NOT HAVE_FINITE) > check_symbol_exists(_finite "math.h" _HAVE_FINITE) > if(NOT _HAVE_FINITE) > check_function_exists(_finite _HAVE_FINITE2) > endif(NOT _HAVE_FINITE) > set(_HAVE_FINITE ${_HAVE_FINITE2}) > set(HAVE_FINITE ${_HAVE_FINITE} CACHE INTERNAL "Have function _finite") > endif(NOT HAVE_FINITE) There are a number of problems in the above logic. (*) HAVE_FINITE, HAVE_FINITE2, _HAVE_FINITE and _HAVE_FINITE2 are all cached as a result of check_symbol_exists and check_function_exists. (See the commands SET(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") and SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") in CheckSymbolExists.cmake and CheckFunctionExists.cmake). So all further attempts to set those variables should also mention CACHE INTERNAL or else you should use a different name (UNCACHED_HAVE_FINITE ?) for the uncached variables you are setting. (In CMake the same name can refer to separate variables, the cached one and the uncached one.) It's possible the current logic works, but with this reuse of names it gets quite confusing so I would advocate using separate names for variables that mean separate things, and definitely you should not use the same name for both a cached variable and uncached variable. (*) The set(HAVE_FINITE ${HAVE_FINITE2}) assumes check_function_exists(finite HAVE_FINITE2) has been called, but what if the first check_symbol_exists succeeds? Then, that success is ignored, HAVE_FINITE2 is undefined, and then you start looking incorrectly for the _finite symbol or _finite function. Once those two issues are straightened out, I think the logic will work both the first manual time and subsequent automatic times cmake is called. Note, on the second and subsequent times, the cache is used to retrieve values rather than actually doing the checks to determine those values. That is why CMake is so notorious for speed, but it also means you have to be careful of whether variables are cached or not like I advocate above. > Anyway, do you both can help me to solve this problem, since I'm not > sure how to proceed. I would suggest the above changes. Then debug the second and subsequent times cmake is run by putting in lots of message statements to verify all values are being set correctly from the cache. Good luck sorting this out. 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 equationofstate 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). __________________________ Linuxpowered Science __________________________ 
From: Werner Smekal <smekal@ia...>  20090227 21:13:37

Hi Alan, > > There are a number of problems in the above logic. > > (*) HAVE_FINITE, HAVE_FINITE2, _HAVE_FINITE and _HAVE_FINITE2 are all > cached > as a result of check_symbol_exists and check_function_exists. (See the > commands > > SET(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") > > and > > SET(${VARIABLE} 1 CACHE INTERNAL "Have function ${FUNCTION}") > > in CheckSymbolExists.cmake and CheckFunctionExists.cmake). So all > further > attempts to set those variables should also mention CACHE INTERNAL or > else > you should use a different name (UNCACHED_HAVE_FINITE ?) for the uncached > variables you are setting. (In CMake the same name can refer to separate > variables, the cached one and the uncached one.) It's possible the > current > logic works, but with this reuse of names it gets quite confusing so I > would > advocate using separate names for variables that mean separate things, > and > definitely you should not use the same name for both a cached variable > and > uncached variable. > > (*) The > > set(HAVE_FINITE ${HAVE_FINITE2}) > > assumes check_function_exists(finite HAVE_FINITE2) has been called, but > what if the first check_symbol_exists succeeds? Then, that success is > ignored, HAVE_FINITE2 is undefined, and then you start looking > incorrectly > for the _finite symbol or _finite function. > > Once those two issues are straightened out, I think the logic will > work both > the first manual time and subsequent automatic times cmake is called. > Note, > on the second and subsequent times, the cache is used to retrieve values > rather than actually doing the checks to determine those values. That is > why CMake is so notorious for speed, but it also means you have to be > careful of whether variables are cached or not like I advocate above. > >> Anyway, do you both can help me to solve this problem, since I'm not >> sure how to proceed. > > I would suggest the above changes. Then debug the second and subsequent > times cmake is run by putting in lots of message statements to verify all > values are being set correctly from the cache. > > Good luck sorting this out. Thanks for the explanations. I changed the code now to: check_symbol_exists(finite "math.h" HAVE_FINITE) if(NOT HAVE_FINITE) check_function_exists(finite HAVE_FINITE2) if(HAVE_FINITE2) set(HAVE_FINITE ${HAVE_FINITE2} CACHE INTERNAL "Have function finite") else(HAVE_FINITE2) check_symbol_exists(_finite "math.h" _HAVE_FINITE) if(NOT _HAVE_FINITE) check_function_exists(_finite _HAVE_FINITE2) if(_HAVE_FINITE2) set(_HAVE_FINITE ${_HAVE_FINITE2} CACHE INTERNAL "Have function _finite") set(HAVE_FINITE ${_HAVE_FINITE} CACHE INTERNAL "Have function _finite") endif(_HAVE_FINITE2) set(_HAVE_FINITE2 "" CACHE INTERNAL "Have function _finite") endif(NOT _HAVE_FINITE) endif(HAVE_FINITE2) set(HAVE_FINITE2 "" CACHE INTERNAL "Have function finite") endif(NOT HAVE_FINITE) This works now, and using Visual C++ doesn't always lead to reconfiguration. And if cmake is run again, the variables are taken correctly from the cache. What I don't understand is, that check_symbol_exists(finite "math.h" HAVE_FINITE) if(NOT HAVE_FINITE) check_function_exists(finite HAVE_FINITE) endif(NOT HAVE_FINITE) Doesn't work. check_function_exists is called, but IF("${VARIABLE}" MATCHES "^${VARIABLE}$") in CheckFunctionsExists.cmake/CheckFunctionsExists.cmake is true for check_symbol_exists and false for check_function_exists???? HAVE_FINITE is both times "".I also don't understand "${VARIABLE}" MATCHES "^${VARIABLE}$"  I was playing around with a regex checker and no matter what I did ("test" matches "^test$", "" matches "^$", etc.) this statement was always true. Why it is false for check_function_exists I don't get. This would make the logic a lot easier .... Regards, Werner > > 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 equationofstate > 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). > __________________________ > > Linuxpowered Science > __________________________  Dr. Werner Smekal Institut fuer Allgemeine Physik Technische Universitaet Wien Wiedner Hauptstr 810 A1040 Wien Austria DVRNr: 0005886 email: smekal@... web: http://www.iap.tuwien.ac.at/~smekal phone: +43(0)15880113463 (office) +43(0)15880113469 (laboratory) fax: +43(0)15880113499 
From: Alan W. Irwin <irwin@be...>  20090227 23:25:38

On 20090227 22:13+0100 Werner Smekal wrote: > Hi Alan, > [out of order]What I don't understand is, that > > check_symbol_exists(finite "math.h" HAVE_FINITE) > if(NOT HAVE_FINITE) > check_function_exists(finite HAVE_FINITE) > endif(NOT HAVE_FINITE) > > Doesn't work. check_function_exists is called, but IF("${VARIABLE}" MATCHES > "^${VARIABLE}$") in CheckFunctionsExists.cmake/CheckFunctionsExists.cmake is > true for check_symbol_exists and false for check_function_exists???? > HAVE_FINITE is both times "".I also don't understand "${VARIABLE}" MATCHES > "^${VARIABLE}$"  I was playing around with a regex checker and no matter > what I did ("test" matches "^test$", "" matches "^$", etc.) this statement > was always true. Why it is false for check_function_exists I don't get. This > would make the logic a lot easier .... IF("${VARIABLE}" MATCHES "^${VARIABLE}$") Is CMake2.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. > Thanks for the explanations. I changed the code now to: > > check_symbol_exists(finite "math.h" HAVE_FINITE) > if(NOT HAVE_FINITE) > check_function_exists(finite HAVE_FINITE2) > if(HAVE_FINITE2) > set(HAVE_FINITE ${HAVE_FINITE2} CACHE INTERNAL "Have function finite") > else(HAVE_FINITE2) > check_symbol_exists(_finite "math.h" _HAVE_FINITE) > if(NOT _HAVE_FINITE) > check_function_exists(_finite _HAVE_FINITE2) > if(_HAVE_FINITE2) > set(_HAVE_FINITE ${_HAVE_FINITE2} CACHE INTERNAL "Have function > _finite") > set(HAVE_FINITE ${_HAVE_FINITE} CACHE INTERNAL "Have function > _finite") > endif(_HAVE_FINITE2) > set(_HAVE_FINITE2 "" CACHE INTERNAL "Have function _finite") > endif(NOT _HAVE_FINITE) > endif(HAVE_FINITE2) > set(HAVE_FINITE2 "" CACHE INTERNAL "Have function finite") > endif(NOT HAVE_FINITE) > > This works now, and using Visual C++ doesn't always lead to reconfiguration. > And if cmake is run again, the variables are taken correctly from the cache. I suggest you drop all reuse 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 ) 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 reuse 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 equationofstate 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). __________________________ Linuxpowered Science __________________________ 
From: Werner Smekal <smekal@ia...>  20090303 07:28:50

Hi Alan, > > IF("${VARIABLE}" MATCHES "^${VARIABLE}$") > > Is CMake2.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 reuse 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 cmakegui. 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 reuse 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 equationofstate > 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). > __________________________ > > Linuxpowered Science > __________________________ > >  > Open Source Business Conference (OSBC), March 2425, 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 > _______________________________________________ > Plplotdevel mailing list > Plplotdevel@... > https://lists.sourceforge.net/lists/listinfo/plplotdevel  Dr. Werner Smekal Institut fuer Allgemeine Physik Technische Universitaet Wien Wiedner Hauptstr 810 A1040 Wien Austria email: smekal@... web: http://www.iap.tuwien.ac.at/~smekal phone: +43(0)15880113463 (office), +43(0)15880113469 (laboratory) fax: +43(0)15880113499 
Sign up for the SourceForge newsletter:
No, thanks