Hi Eric, On Wednesday 01 July 2009 18:28:57 Eric Noulard wrote: > 2009/7/1 Marcel Loose <[email protected]>: > > Hi all, > > > > In a number of standard CMake modules I encountered the following line: > > > > IF("${VARIABLE}" MATCHES "^${VARIABLE}$") > > > > Can anyone explain the rationale of this conditional to me. > > The rational no but .... > > > To my cluttered mind this seems to be an "always-true" condition. > > this is definitely not always true. > The variable your are testing may contain "un-evaluated" var > or some special regex character( *, ?, ...) > > See attached example, you may test it with > $ cmake -P matches.cmake > MATCHES -- MYVAR = A good var > Look that one = double-dollar = blah / single-dollar = MYVAR2 > NO MATCHES ** MYVAR = MYVAR2 > $ > > However I have no such usage currently :-)
If I understand your script correctly, then the trick of this construct is to check whether the variable MYVAR is defined in terms of one (or more) other variables. Correct? If so, I still don't quite get the usage pattern in, e.g., CheckIncludeFile.cmake. What are they trying to check? Best regards, Marcel Loose. _______________________________________________ Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
