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

Eric Noulard eric.noulard at gmail.com
Thu Mar 19 10:37:26 EDT 2009


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


> There's a C++ source file t_hello.cc in the test directory that should
> be compiled to produce an executable t_hello.

Then this executable should be built with add_executable somehow
add_test macro does not compile anything, that's may be were you
have missed something.

add_test(testname Exename arg1 arg2 ...)

Exename should exists: either as an add_executable target or because
it's a sripts etc....
CTest won't BUILD Exename even if there is Exename.cpp in the
appropriate directory.

> So yes, maybe I'm using
> the wrong arguments. It's not really clear to me what I should specify
> for --build-project and --test-command. As I said: I must be doing
> something wrong, but I don't know what exactly.

I think (but I may be wrong too) that you supposed may build needed executable
from source of the same name. This is not the case, CTest is **only**
executing some prebuilt executable with given agrument.

>
> BTW, you broke up the output of "ctest -V", which might suggest that you
> think I entered several commands, but that's not the case.

I did know that, I did cut in order to minimize the mail size.
I was trying to show you that your single call to ctest is generating
a recursive call.


-- 
Erk


More information about the CMake mailing list