[CMake] How to write a correct wrapper of MESSAGE()?
Clark WANG
dearvoid at gmail.com
Fri Sep 27 04:18:10 EDT 2013
I'm trying to write some MESSAGE() wrappers like info(), warning(),
fatal(), etc which may be a bit easier to use. But I failed to simulate the
correct MESSAGE() behavior no matter I use MACRO or FUNCTION. For example:
MACRO(info_mac_1)
message("[MACRO 1] " ${ARGV})
ENDMACRO()
MACRO(info_mac_2)
message("[MACRO 2] " "${ARGV}")
ENDMACRO()
FUNCTION(info_fun_1)
message("[FUNC 1] " ${ARGV})
ENDFUNCTION()
FUNCTION(info_fun_2)
message("[FUNC 2] " "${ARGV}")
ENDFUNCTION()
message("foo;bar")
info_mac_1("foo;bar")
message(foo bar)
info_mac_2(foo bar)
message("foo;bar")
info_fun_1("foo;bar")
message(foo bar)
info_fun_2(foo bar)
The output (tested with 2.8.8) would be like this:
foo;bar
[MACRO 1] foobar
foobar
[MACRO 2] foo;bar
foo;bar
[FUNC 1] foobar
foobar
[FUNC 2] foo;bar
As you can see all the 4 commands I defined did not work the same way as
MESSAGE(). So how should I define a correct wrapper on MESSAGE()?
Thanks.
-Clark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130927/22faf6f2/attachment.htm>
More information about the CMake
mailing list