[CMake] Target dependencies

David Cole david.cole at kitware.com
Mon Aug 25 10:08:05 EDT 2008


The DEPENDS of ADD_CUSTOM_TARGET expects file names, not target names. So it
can't find a file named foo...
To set up inter-target dependencies, use ADD_DEPENDENCIES.


On Mon, Aug 25, 2008 at 9:03 AM, Boris Boesler <baembel at gmx.de> wrote:

> Hi!
>
>  For the cmake-code at the end of this email I get the following error
> during running make (cmake runs without problems):
>
> Scanning dependencies of target foo
> [  0%] Fooing ..
> foo
> [ 50%] Built target foo
> Scanning dependencies of target bar
> make[3]: *** No rule to make target `foo', needed by `CMakeFiles/bar'.
>  Stop.
> make[2]: *** [CMakeFiles/bar.dir/all] Error 2
> make[1]: *** [CMakeFiles/bar.dir/rule] Error 2
> make: *** [bar] Error 2
>
>  No rule for target "foo" that has been built already? I can't see what's
> wrong with my rules. Is it a bug?
>
> Thanks,
> Boris
>
>
> ADD_CUSTOM_TARGET(foo
>  COMMAND echo "foo"
>  COMMENT "Fooing ..")
>
> ADD_CUSTOM_TARGET(bar
>  COMMAND echo "bar"
>  DEPENDS foo
>  COMMENT "Bar-tender ..")
>
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20080825/c4bc4e08/attachment-0001.htm>


More information about the CMake mailing list