[CMake] add_test does not work as documented

2010-09-21 Thread Jesper Eskilson

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 $), it fails:


  add_test(mytest ${SOMEVARIABLE}/$/MyExe)

fails to locate MyExe correctly, since it isn't expanding 
$ correctly.



Looked in the following places:
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Release/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Release/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Debug/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Debug/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/MinSizeRel/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/MinSizeRel/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/RelWithDebInfo/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/RelWithDebInfo/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Deployment/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Deployment/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Development/TestIDE
/home/jesperes/dev/tooticki/core/ide/../stage/$/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


Re: [CMake] add_test does not work as documented

2010-09-21 Thread David Cole
On Tue, Sep 21, 2010 at 4:19 AM, Jesper Eskilson 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 $), it fails:
>
>  add_test(mytest ${SOMEVARIABLE}/$/MyExe)
>
> fails to locate MyExe correctly, since it isn't expanding $
> correctly.
>
>  Looked in the following places:
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Release/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Release/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Debug/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Debug/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/MinSizeRel/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/MinSizeRel/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/RelWithDebInfo/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/RelWithDebInfo/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Deployment/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Deployment/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/common/bin/Development/TestIDE
>>
>> /home/jesperes/dev/tooticki/core/ide/../stage/$/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
>


$ 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
___
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

Re: [CMake] add_test does not work as documented

2010-09-21 Thread Jesper Eskilson

On 09/21/2010 01:30 PM, David Cole wrote:


$ 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.


Ok, thanks.

(I didn't find any mention of this. Maybe the add_test() documentation 
ought to say something about it.)


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