You're close - the test property is named LABELS
, not LABEL
.
There are a couple of ways of setting labels; the one you've chosen (using set_tests_properties
) has a slight gotcha. The signature is:
set_tests_properties(test1 [test2...] PROPERTIES prop1 value1 prop2 value2)
This means that each property can only have a single value applied. So if you want to apply multiple labels to tests this way, you need to "trick" CMake by passing the list of labels as a single string comprising a semi-colon-separated list:
set_tests_properties(FirstTest PROPERTIES LABELS "TESTLABEL;UnitTest;FooModule")
or
set(Labels TESTLABEL UnitTest FooModule)
set_tests_properties(FirstTest PROPERTIES LABELS "${Labels}") # Quotes essential
On the other hand, you can pass a proper list of labels using the more general set_property
command:
set_property(TEST FirstTest PROPERTY LABELS TESTLABEL UnitTest FooModule)
or
set_property(TEST FirstTest PROPERTY LABELS ${Labels}) # No quotes needed
The slight downside of this command is that you can only apply one property per call.