I would argue that the following snippet of code should either print
"CAT" twice or die.  Unfortunately it first prints "DOG" and then "CAT".

Thanks,

Juan

MACRO(FOO BAR)
  SET (BAR "CAT")
  MESSAGE("${BAR}")
ENDMACRO(FOO)

FOO(DOG)
MESSAGE("${BAR}")



Bill Hoffman wrote:
> Juan Sanchez wrote:
>> What I was trying to do was to avoid having to create a local variable.
>>  The macro parameter is the default, which can be overridden if necessary.
>>
>> Now I immediately have to set a new variable with the value of the
>> parameter.  So I now have to account for another variable being created
>> which may then escape the macro's namespace.
>>
>> Can we have the SET command fail on trying to set a macro parameter?
>>   
> You are thinking about macros in the wrong way.   Think of them as c or 
> c++ #define macro's.
> Basically, they do nothing more than string replacement. 
> 
> -Bill
> 
> 
> 


-- 
Juan Sanchez
[EMAIL PROTECTED]
800-538-8450 Ext. 54395
512-602-4395


_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to