[Cmake] Substitution or not between quotes?
Brad King
brad.king at kitware.com
Mon Aug 23 07:33:11 EDT 2004
Martin Trudeau wrote:
> could you give me an example
> where quotes in the first argument of an IF with ${...}present
> have indeed an effect?
SET(x y z)
IF("${x}")
ENDIF("${x}")
Without the double quotes, the expansion produces
IF(y z)
ENDIF(y z)
which is not a valid IF command.
> And what do you do when you want
> to match a string to a regular expression
>
> IF ("some_string" MATCHES regex)
>
> but are not sure some_string isn't already defined?
> Do you absolutely have to test it first with IF(DEFINED...)?
Yes. I agree this is strange behavior but there are historical and
backward compatibility reasons for it.
-Brad
More information about the Cmake
mailing list