[CMake] macro/functions in ctest scripts

Matthew Woehlke matthew.woehlke at kitware.com
Thu Aug 8 11:32:38 EDT 2013


On 2013-08-08 09:24, Jakub Zakrzewski wrote:
> On 2013-08-08 09:08, Yngve Inntjore Levinsen wrote:
>> macro(hello MESSAGE)
>>     message("${MESSAGE}")
>> endmacro(hello)
>> hello("Hello World")
>>
>> This does not work (it gives a warning that the message command was
>> called with wrong number of arguments). However, if I try to call
>> just hello() I get an error stating that I called the macro with
>> the wrong number of arguments.. What am I doing wrong here? I found
>> the samebehaviour with functions.
>
> You're expecting MESSAGE to be variable name but you call it with string value. So
> message("${MESSAGE}")
> evaluates to
> message("${Hello World}")

...eh? I'm pretty sure "${MESSAGE}" -> "Hello World".

That said, have you tried naming the variable other than the name of a 
built-in command? I could imagine that might cause problems...

-- 
Matthew



More information about the CMake mailing list