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 :-)

-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org

Attachment: matches.cmake
Description: Binary data

_______________________________________________
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

Reply via email to