[cmake-developers] Weird behaviour of arguments in macro

Alexander Neundorf neundorf at kde.org
Thu Nov 14 13:13:25 EST 2013


On Thursday 14 November 2013, Daniele E. Domenichelli wrote:
> Hello,
> 
> When calling a macro, the variables can be dereferenced but they are not
> DEFINED, and the list() command fails in several way (please have a look
> at the attached test for more details)
> 
> Is this a wanted behaviour? 

Basically, yes.
The arguments of macro invocations are no variables, it's a real macro, they 
are replaced with the actual arguments.
So whenever a command inside the macro refers to the variable "_bar", it fails 
(or it sees a _bar which might happen to exist in the "calling" scope).

Alex



More information about the cmake-developers mailing list