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

Marcel Loose loose at astron.nl
Fri Mar 20 06:59:58 EDT 2009


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?

Best regards,
Marcel Loose.





More information about the CMake mailing list