[CMake] Stop substitution in passthrough list arguments?
Chris Green
greenc at fnal.gov
Thu Mar 3 00:12:39 EST 2011
Hi,
I have a macro which takes a variety of arguments and does all the
things necessary for making a test: compiling the exec (or copying the
script), putting input files in the right place and setting desired
properties on the test. I use the ParseArguments
<http://www.cmake.org/Wiki/CMakeMacroParseArguments> macro found on the
Wiki to handle all the switches and optional list arguments and at some
point I ended up using this system to pass a PASS_REGULAR_EXPRESSION
property through my macro and the argument parser. Unfortunately, by the
time it was processed by the embedded SET_TESTS_PROPERTIES command, what
would have been a simple:
SET_TESTS_PROPERTIES (Unscheduled_03_t PROPERTIES PASS_REGULAR_EXPRESSION
"Assertion `handle.isValid\\(\\) == require_presence_' failed."
)
command became:
cet_test(Unscheduled_03_t HANDBUILT
TEST_EXEC test_must_abort
TEST_ARGS art -c "Unscheduled_03_t.fcl"
TEST_PROPERTIES PASS_REGULAR_EXPRESSION
"Assertion `handle.isValid\\\\\\\\(\\\\\\\\) == require_presence_' failed."
DATAFILES
fcl/Unscheduled_03_t.fcl
fcl/messageDefaults.fcl
)
Note that the parentheses required no less than eight backslash escapes
each in order to be interpreted correctly by the time they were seen by
the SET_TESTS_PROPERTIES command.
Is there any way at all to pass this (or any other) argument through the
cet_test macro's argument parser and embedded SET_TESTS_PROPERTIES
command without getting all those backslashes swallowed? If not, can
there be?
For illustration purposes, the relevant lines from cet_macro are:
MACRO(cet_test CET_TARGET)
#<snip>
CET_PARSE_ARGS(CET
"DATAFILES;DEPENDENCIES;LIBRARIES;SOURCES;TEST_ARGS;TEST_EXEC;TEST_PROPERTIES"
"HANDBUILT;PREBUILT;NO_AUTO;USE_BOOST_UNIT;INSTALL_EXAMPLE;INSTALL_SOURCE"
${ARGN}
)
#<snip>
IF(CET_TEST_PROPERTIES)
SET_TESTS_PROPERTIES(${CET_TARGET} PROPERTIES ${CET_TEST_PROPERTIES})
ENDIF()
#<snip>
Thanks for your help,
Chris.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110302/7b063c72/attachment.htm>
More information about the CMake
mailing list