[CMake] Using variable to store variable name

Brad King brad.king at kitware.com
Tue Apr 5 08:37:16 EDT 2005


Paul Smyth wrote:
> You can build a variable name from a the value of another variable. And
> then extract the value pointed to my the built variable name.
> Like so: (taken from UseSWIG.cmake)
> ${SWIG_MODULE_${name}_REAL_NAME}

Currently this works only inside a MACRO or FOREACH block and the inner 
${foo} can only refer to the loop variable or macro arguments.  We are 
working on making it work for arbitrary variables but it is not yet 
implemented.

> Am I realistic in expecting this to work?

Yes, and the current behavior is definately confusing.  This is why we 
are fixing it.

-Brad


More information about the CMake mailing list