[Cmake] Substitution or not between quotes?

Martin Trudeau mtrudeau at info-internet.net
Mon Aug 23 02:56:44 EDT 2004


Hi Brad.

Thanks for your explanation. There are still two things
I'm wondering about. You said:

>The presence of the quotes in the first argument of an IF command has no 
>effect unless a ${...} is present.

Since both 

#########################
SET(x y)
SET(y z)
IF("${x}" MATCHES "z")
    MESSAGE("match")
ELSE("${x}" MATCHES "z")
    MESSAGE("no match")
ENDIF("${x}" MATCHES "z")
#########################

and

#########################
SET(x y)
SET(y z)
IF(${x} MATCHES "z")
    MESSAGE("match")
ELSE(${x} MATCHES "z")
    MESSAGE("no match")
ENDIF(${x} MATCHES "z")
#########################

produce the same output "match", could you give me an example
where quotes in the first argument of an IF with ${...}present 
have indeed an effect? 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...)?

Thanks.

-Martin


More information about the Cmake mailing list