[CMake] Howto unset cache variable without UNSET()

Chris Hillery chillery-cmake at lambda.nu
Wed Jun 30 12:29:19 EDT 2010


On Wed, Jun 30, 2010 at 9:13 AM, Marcel Loose <loose at astron.nl> wrote:

> I think I could live with using an empty string and then use
> 'if(VAR MATCHES "^$")', instead of 'if(DEFINED VAR)'.
>

You probably know this, but in the vast majority of cases you could just use
'if(VAR)'. That will be true as long as VAR is not undefined, 0, "", N, NO,
OFF, FALSE, NOTFOUND, or <variable>-NOTFOUND.

If you really need to only match empty string, then probably 'if(VAR
STREQUAL "")' would be a little easier to read and type.

Ceej
aka Chris Hillery
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100630/9e84ace8/attachment.htm>


More information about the CMake mailing list