-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Jakub Zakrzewski
Sent: Donnerstag, 8. August 2013 15:24
To: Yngve Inntjore Levinsen; [email protected]
Subject: Re: [CMake] macro/functions in ctest scripts



-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Yngve Inntjore Levinsen
Sent: Donnerstag, 8. August 2013 15:09
To: [email protected]
Subject: [CMake] macro/functions in ctest scripts

Hi,

I have a project where we use ctest/cdash but not cmake. I wanted to add a 
macro, but it looks like it doesn't support arguments correctly?
(differing from the documentation in 'ctest --help-command macro')

I tried to add this to the CTestTestfile.cmake:

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 same behaviour with 
functions.


Cheers,
Yngve
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Hi,

>>macro(hello MESSAGE)
>>   message("${MESSAGE}")
>>endmacro(hello)
>>hello("Hello World")

You're expecting MESSAGE to be variable name but you call it with string value. 
So 
message("${MESSAGE}")
evaluates to
message("${Hello World}")
and this to
message("")
and cmake does not like calling it with empty string :)


--
Gruesse,
Jakub



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Hi,

a neee - just ignore this - I need more sleep...

This indeed looks like a correct piece of code.
Moreover - it works perfectly with my ctest...


--
Gruesse,
Jakub



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to