[CMake] make check problem

William A. Hoffman billlist at nycap.rr.com
Sat Jul 29 11:03:05 EDT 2006


All make test does is run ctest, so it may be easier to just run
ctest from the custom target check directly.  

But if you want to do it this way, you can use :
http://www.cmake.org/HTML/Documentation.html

ADD_DEPENDENCIES: Add a dependency between top-level targets.

  ADD_DEPENDENCIES(target-name depend-target1
                   depend-target2 ...)

Make a top-level target depend on other top-level targets. A top-level target is one created by ADD_EXECUTABLE, ADD_LIBRARY, or ADD_CUSTOM_TARGET. Adding dependencies with this command can be used to make sure one target is built before another target. See the DEPENDS option of ADD_CUSTOM_TARGET and ADD_CUSTOM_COMMAND for adding file-level dependencies in custom rules. See the OBJECT_DEPENDS option in SET_SOURCE_FILES_PROPERTIES to add file-level dependencies to object files. 


The DEPENDS in here only can only refer to files:
ADD_CUSTOM_TARGET: Add a target with no output so it will always be built.

  ADD_CUSTOM_TARGET(Name [ALL] [command1 [args1...]]
                    [COMMAND command2 [args2...] ...]
                    [DEPENDS depend depend depend ... ])
                    [WORKING_DIRECTORY dir]

Adds a target with the given name that executes the given commands every time the target is built. If the ALL option is specified it indicates that this target should be added to the default build target so that it will be run every time (the command cannot be called ALL). The command and arguments are optional and if not specified an empty target will be created. If WORKING_DIRECTORY is set, then the command will be run in that directory. Dependencies listed with the DEPENDS argument may reference files and outputs of custom commands created with ADD_CUSTOM_COMMAND. Dependencies on other targets may be added using the ADD_DEPENDENCIES command. 

-Bill


At 07:36 AM 7/29/2006, Marcelo Fontenele S Santos wrote:
>Hi,
>
>I am trying to create an alias for the "test" target called "check" in
>order to use some tools that work with autotools' generated Makefiles.
>
>I tried the following:
>
>ADD_EXECUTABLE( stuff_test stuff_test.cpp )
>
>ADD_TEST( stuff_test stuff_test )
>
>ADD_CUSTOM_TARGET( check DEPENDS test )
>
>When I run "make test" it works:
>
>Running tests...
>Start processing tests
>Test project
>  1/  1 Testing stuff_test                       Passed
>
>100% tests passed, 0 tests failed out of 1
>
>but when I run "make check" this is the result:
>
> *** No rule to make target `cmaketest/test', needed by `check'.  Stop.
>
>I think the problem is in the way CTest defines the test target.
>
>Can anyone help me?
>
>Thanks,
>-- 
>Marcelo Fontenele S Santos<msantos at pobox.com>
>
>
>
>
>_______________________________________________
>CMake mailing list
>CMake at cmake.org
>http://www.cmake.org/mailman/listinfo/cmake 



More information about the CMake mailing list