[CMake] How to emulate autotools "make check"?
Marcel Loose
loose at astron.nl
Fri Mar 20 05:34:09 EDT 2009
Hi Erk,
Thanks for your prompt reply. Your example works great.
In the mean time, I found another way to solve my problem:
add_custom_target(check DEPENDS t_hello)
add_custom_command(TARGET t_hello POST_BUILD
COMMAND ${CMAKE_CTEST_COMMAND} t_hello)
But I think I prefer your solution; it saves an extra
add_custom_target() statement.
On Fri, 2009-03-20 at 10:06 +0100, Eric Noulard wrote:
> 2009/3/20 Marcel Loose <loose at astron.nl>:
> > Hi Erk,
> >
> > On Thu, 2009-03-19 at 15:37 +0100, Eric Noulard wrote:
> >> 2009/3/19 Marcel Loose <loose at astron.nl>:
> >> > Hi Eric,
> >> >
> >> > I used "make test" first, but that failed the same way ctest fails.
> >> > However, ctest -V at least gave me some more (useful) output.
> >>
> >> You are right there is no "functional" difference,
> >> in one case you'll have
> >> make test --> ctest --> ctest
> >> and in the other
> >> ctest --> ctest
> >
> > I still don't understand why ctest is being called twice, or (as you
> > say) recursively.
>
> 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 ...]
Best regards,
Marcel Loose
More information about the CMake
mailing list