[CMake] How to emulate autotools "make check"?

Eric Noulard eric.noulard at gmail.com
Fri Mar 20 05:50:37 EDT 2009


2009/3/20 Marcel Loose <loose at astron.nl>:
>>
>> Because you ask for it :-)
>> when calling ctest in add_test.
>
> Ok, I see.
> But how then, should I read the example from section 10.5 from the
> "Mastering CMake" book? Here's a quote from page 167.
>
> <qoute>
> For example, consider the following ADD_TEST command taken from the
> CMakeLists.txt file of CMake itself. It shows how CTest can be used both
> to compile and run a test.
>
>  add_test (simple ${CMAKE_TEST_COMMAND}
>    --build-and-test "${CMake_SOURCE_DIR}/Tests/Simple"
>                     "${CMake_BINARY_DIR}/Tests/Simple"
>    --build-generator ${CMAKE_GENERATOR}
>    --build-makeprogram ${CMAKE_MAKE_PROGRAM}
>    --build-project Simple
>    --test-command simple)
>
> </quote>
>
> This quote contradicts the statement you made in an earlier reply that
> [... CTest is **only** executing some prebuilt executable with given
> agrument ...]

I did oversimplify and mixed things.

ADD_TEST macro does only specify what command is to be run for the named test
then the ctest command (directly called or through make test) runs the
specified executables.

the ctest command itself may do far more operations (CVS/SVN checkout/update,
configure/build with CMake, run the tests exe, publish to  dashboard etc....)

thus the example in the CMake book.
I don't have a copy of this book so I may not check but I would guess
that the enclosing project where you find the add_test with ctest call example
is not the same project as the one that will be generated whithin add_test,
so you do not have the recursion project but just a project A test which role
is to build and run a project B test.

Just a guess, because without the book :-)

-- 
Erk


More information about the CMake mailing list