[CMake] Dynamic variable name construction doesn't work with ARGV[n] ?

Christian Convey christian.convey at gmail.com
Fri Jul 27 23:01:18 EDT 2007


Could someone please explain why this code works:

SET(FOO 10)
SET(FOONAME FOO)
MESSAGE("FOO = ${${FOONAME}}")

but this code does not?

MACRO(BAR)
   MESSAGE("ARGV0 = ${ARGV0}")
   SET(ARGV0_NAME ARGV0)
   MESSAGE("ARGV0 = ${${ARGV0_NAME}}")
ENDMACRO(BAR)

BAR(123)

In the first block of code, "FOO = 10" is printed to the console when
I run this through CMake.

But in the second block of code (using the "BAR" macro), I get this output:
ARGV0 = 123
ARGV0 =

So why can I dynamically construct the variable name in the first
example ("FOO = 10"), but in the second example ("ARGV0 = ") ?

Thanks,
Christian


More information about the CMake mailing list