[cmake-developers] Alternate if() without implicit variable expansion

Nils Gladitz nilsgladitz at gmail.com
Thu Sep 4 10:25:21 EDT 2014


This keeps coming up and there probably have been many discussions on 
how this might be "fixed" as well.

I am wondering if we could provide an alias for the "if" command (e.g. 
"safe_if") that would inherit cmIfCommand but would reimplement 
GetVariableOrString() without the variable lookup.

This would leave if() behavior intact for compatibility but would 
provide an alternative with less surprising semantics.

I would keep else() elseif() endif() without additional aliases and 
leave the behavior to the initial if variant.

Nils


More information about the cmake-developers mailing list