[CMake] if(string MATCHES regex) question

Bill Lorensen bill.lorensen at gmail.com
Fri Jul 3 14:45:31 EDT 2009


Ancient is in the eye of the beholder. The CMake folks appear to take
backward compatibility seriously. You will appreciate this in ten
years when you revive a project that uses CMake.

Bill


On Fri, Jul 3, 2009 at 12:54 PM, Marcel Loose<loose at astron.nl> wrote:
> Wow,
>
> So this really is ancient code!
> Thanks for the explanation.
>
> Best regards,
> Marcel Loose
>
> On Fri, 2009-07-03 at 07:59 -0400, Brad King wrote:
>> Eric Noulard wrote:
>> >> If so, I still don't quite get the usage pattern in, e.g.,
>> >> CheckIncludeFile.cmake. What are they trying to check?
>> >
>> > Better ask the author of this file :-)
>>
>> This was a hack left from before the 'DEFINED' option was
>> available from the if() command.  The code
>>
>>    if(VAR MATCHES "^VAR$")
>>
>> is almost equivalent to
>>
>>    if(NOT DEFINED VAR)
>>
>> because the if() command replaces VAR with ${VAR} implicitly
>> when VAR is defined (but '^VAR$' is not defined and does not
>> get replaced).  The implicit conversion is left from *very*
>> early CMake when there was no ${} syntax.
>>
>> -Brad
>
> _______________________________________________
> 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
>


More information about the CMake mailing list