[CMake] Pass args to ctest through "make check"

Orion Poplawski orion at cora.nwra.com
Sat Aug 3 10:12:33 EDT 2013


On 08/01/2013 04:57 PM, Orion Poplawski wrote:
> On 07/31/2013 03:08 PM, Orion Poplawski wrote:
>> Is there a way to pass arguments to ctest via the "make check" target?
>>
>
> Okay, here's what's up.  This recipe:
> http://www.cmake.org/Wiki/CMakeEmulateMakeCheck :
>
> add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})
>
> is not terribly useful in that it appears impossible to pass options to
> ctest from the "make check" command line.  In Fedora packaging we want
> to generally add -V and sometimes exclude certain tests with -E
> 'test1|test2|...'.
>
> I tried doing:
>
> cmake -DCMAKE_CTEST_COMMAND="/usr/bin/ctest -V -E 'test'"
>
> but then I end up with:
>
> CMakeFiles/check.dir/build.make:
> CMakeFiles/check:
>          "/usr/bin/ctest -V -E 'test'"
>
> which fails because of the quoting:
>
> make[3]: Entering directory
> `/builddir/build/BUILD/eigen-eigen-ffa86ffb5570/noarch-redhat-linux-gnu'
> "/usr/bin/ctest -V -E 'gmres_2|minres_1|bdcsvd_2'"
> /bin/sh: /usr/bin/ctest -V -E 'gmres_2|minres_1|bdcsvd_2': No such file
> or directory
> make[3]: *** [CMakeFiles/check] Error 127
>
>
> At least with the old style:
>
> add_custom_target(check COMMAND ${CMAKE_BUILD_TOOL} test)
>
> You had access to the ARGS variable passed to ctest in the test target.
> Although that apparently breaks parallel make options
> (http://www.cmake.org/pipermail/cmake/2009-March/027941.html)

So I ended up avoiding calling "make check" and used the project's "make 
buildtests" followed by "make test ARGS=...".



-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA/CoRA Division                    FAX: 303-415-9702
3380 Mitchell Lane                  orion at cora.nwra.com
Boulder, CO 80301              http://www.cora.nwra.com


More information about the CMake mailing list