[CMake] override variable in macro
Dizzy
dizzy at roedu.net
Fri Sep 21 04:32:36 EDT 2007
On Thursday 20 September 2007 20:38:38 Juan Sanchez wrote:
> It appears that the set command cannot override a variable specified as
> a MACRO argument.
>
> For example:
> MACRO (ADD_GADB RCMD)
>
> does not accept changes to RCMD within the macro using the set command.
> Is there a way to override this?
As I understand it (from reading various cmake macros) is that
MACRO "parameters" are not variables. They are "names of variables", they
are "aliases" to variables if you wish. So when you call a macro with the
parameter "someVAR" that in the macro is made to be received as "VARIABLE"
then "VARIABLE" acts like a variable holding the NAME of the argument given
variable (ie holding "someVAR") so then if you need to write/read someVAR you
need to "dereference" VARIABLE (ie SET(${VARIABLE} "value") and not
SET(VARIABLE "value")).
I haven't tried but the macro parameters might be immutable themselves (like
C++ references :) ) so SET(VARIABLE something) might not be supported (but
then again why would you ever need such a thing).
--
Mihai RUSU Email: dizzy at roedu.net
"Linux is obsolete" -- AST
More information about the CMake
mailing list