[CMake] ADD_DEPENDENCIES Adding dependency to non-existent target: doc-test

Alan W. Irwin irwin at beluga.phys.uvic.ca
Mon Feb 5 12:47:18 EST 2007


On 2007-02-05 15:58+0100 frederic heem wrote:

> Hi,
> It seems that ADD_DEPENDENCIES does not allow to add a dependency to every
> target. Here is a brief description of the problem:
> A subdirectory contains a custom target to generate html from a docbook:
>
> ADD_CUSTOM_TARGET(doc-test
>                  COMMAND xmlto html
> ${CMAKE_CURRENT_SOURCE_DIR}/doc/CallDocBook.xml
>                  COMMENT "generate the html documentation")
>
> Each sub-subdirectory has to generate a chapter of the docbook:
>
>  ADD_CUSTOM_TARGET(testFoo
>                    COMMAND java -jar xalan.jar -in testFoo.xml -xsl
> test.xsl -out testFooDocBook.xml)
>  ADD_DEPENDENCIES(doc-test testFoo)
>
> Unfortunately, cmake complains about ADD_DEPENDENCIES(doc-test testFoo):
> ADD_DEPENDENCIES Adding dependency to non-existent target: doc-test
> If ADD_DEPENDENCIES is commented, make help shows the doc-test target.
> Is there a way to overcome this problem ?

The above order won't work (as you have found out), but I think you should
be okay if you do the commands in the following order:

ADD_CUSTOM_TARGET(testFoo ...)
ADD_CUSTOM_TARGET(doc-test ...)
ADD_DEPENDENCIES(doc-test testFoo)

I use that pattern all the time even when the first command is done in
a separate subdirectory.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list