[CMake] add_test does not work as documented
David Cole
david.cole at kitware.com
Tue Sep 21 07:30:51 EDT 2010
On Tue, Sep 21, 2010 at 4:19 AM, Jesper Eskilson <jesper.eskilson at iar.se>wrote:
> Hi,
>
> I cannot get add_test to work as documented.
>
> add_test(mytest MyExe)
>
> correctly runs MyExe. However, if I try to use any of the "generator
> expressions" (such as $<CONFIGURATION>), it fails:
>
> add_test(mytest ${SOMEVARIABLE}/$<CONFIGURATION>/MyExe)
>
> fails to locate MyExe correctly, since it isn't expanding $<CONFIGURATION>
> correctly.
>
> Looked in the following places:
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/Release/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/Release/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/Debug/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/Debug/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/MinSizeRel/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/MinSizeRel/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/RelWithDebInfo/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/RelWithDebInfo/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/Deployment/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/Deployment/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/Development/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$<CONFIGURATION>/common/bin/Development/TestIDE
>>
>
> Also, the form
>
> add_test(NAME mytest COMMAND MyCommand)
>
> doesn't work at all. No tests are generated, and "make test" complains that
> there aren't any tests.
>
> What am I doing wrong?
>
> I'm using CMake 2.8.2.
>
> --
> /Jesper
>
> _______________________________________________
> 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://www.cmake.org/mailman/listinfo/cmake
>
$<CONFIGURATION> only works with the "add_test(NAME mytest COMMAND
MyCommand)" form of the add_test command.
But, when you use that form, you have to run "ctest -C Release" or "ctest -C
Debug" to choose a configuration when you run the tests. Otherwise, tests
added with that form are skipped if ctest is called without a -C argument.
"make test" just runs "ctest" without -C, so you have to change the way you
drive tests to use the add_test(NAME / COMMAND) signature. Usually, this is
useful for folks focused on IDE builds like Visual Studio or Xcode. If you
choose RUN_TESTS from inside the IDE, it already passes a -C arg to ctest,
and so it should work from that context.
HTH,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100921/d3ca694f/attachment.htm>
More information about the CMake
mailing list