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

Eric Noulard eric.noulard at gmail.com
Fri Mar 20 08:44:03 EDT 2009


2009/3/20 Marcel Loose <loose at astron.nl>:
> Hi Erk,
>
> On Fri, 2009-03-20 at 10:06 +0100, Eric Noulard wrote:
>> add_executable(t_hello t_ EXCLUDE_FROM_ALL hello.cpp)
>>
>> add_test(t_hello t_hello)
>>
>> add_custom_target(check
>>                              COMMAND ${CMAKE_BUILD_TOOL} test
>>                              DEPENDS t_hello)
>
> I stumbled upon a tiny problem with your solution:
> make now complains with the following warning:
> gmake[4]: warning: jobserver unavailable: using -j1.  Add `+' to parent
> make rule.
>
> I checked the generated file ./test/CMakeFiles/check.dir/build.make and
> found the line that causes this warning:
>
>  cd /export/home/loose/work/hello/build/test && /usr/bin/gmake test
>
> It is caused by the fact that make is called as /usr/bin/gmake, instead
> of $(MAKE) which is recommended by the GNU Make manual. (See
> http://www.gnu.org/software/automake/manual/make/Error-Messages.html and
> http://www.gnu.org/software/automake/manual/make/MAKE-Variable.html#MAKE-Variable)
>
> I guess that /usr/bin/gmake has been put there as result of the
> expansion of CMAKE_BUILD_TOOL. Would there be a workaround?

I did never cross that one, are you using parallel build? (make -j<N> check)

You may try to run "ctest" command instead "make test"


-- 
Erk


More information about the CMake mailing list