2013/12/2 Nils Gladitz <[email protected]>:
> On 12/02/2013 09:19 AM, Marcel Loose wrote:
>>
>> What would be the preferred way to pass the location of a built executable
>> target to ADD_TEST? By using the COMMAND option of ADD_TEST, or by using the
>> $<TARGET_FILE> generator expression? Best regards, Marcel Loose.
>
> My personal preference would be the NAME/COMMAND signature of add_test().
> I might use the generator expression when the test command would require the
> output file as a parameter (e.g. in case you wrap your test with some sort
> of launcher).

I always use the $<TARGET_FILE> generator expression in add_test(). It
makes the code more robust:
When someone changes the target name (or when there is a typo), the
generator expression cannot be evaluated and an error is reported at
configure time.
When the target name is used without a generator expression, typos can
lead to strange testing results.

cheers, Daniel
--

Powered by www.kitware.com

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

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

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to