[CMake] different behaviour of the same code

Eddy Pronk epronk at muftor.com
Tue Dec 28 13:07:07 EST 2004


Fiddling around with macros, I found out there is different behaviour of 
the same code [${${component}_lib}].
Maybe usage of variables as in M2 is not a good idea, but the output 
seems unexpected.

MACRO(M1 component)
  MESSAGE("M1 called for ${component}")
  MESSAGE(${${component}_lib}) # works
ENDMACRO(M1)

MACRO(M2)
  MESSAGE("M2 called for ${component}")
  MESSAGE(${${component}_lib}) # unexpected output
ENDMACRO(M2)

SET(foo_lib mylib)

SET(component foo) # global scope

M1(foo)
M2()

MESSAGE(${${component}_lib}) # unexpected output


$ cmake --version
cmake version 2.0.5


Eddy Pronk


More information about the CMake mailing list