[CMake] Stop substitution in passthrough list arguments?

Alexander Neundorf a.neundorf-work at gmx.net
Thu Mar 3 12:12:55 EST 2011


On Thursday 03 March 2011, Chris Green wrote:
> 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

Since CMake 2.8.3 this is shipped with CMake, slightly modified.

> 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?

Hmm, not sure.
I think no.
You could pass the name of a variable which contains that string to the macro, 
then there would be no extra escaping necessary.

Alex


More information about the CMake mailing list