Discussion:
[CMake] ADD_DEPENDENCIES Adding dependency to non-existent target: doc-test
frederic heem
2007-02-05 14:58:39 UTC
Permalink
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 ?
Thanks,
Frederic Heem
Alan W. Irwin
2007-02-05 17:47:18 UTC
Permalink
Post by frederic heem
Hi,
It seems that ADD_DEPENDENCIES does not allow to add a dependency to every
ADD_CUSTOM_TARGET(doc-test
COMMAND xmlto html
${CMAKE_CURRENT_SOURCE_DIR}/doc/CallDocBook.xml
COMMENT "generate the html documentation")
ADD_CUSTOM_TARGET(testFoo
COMMAND java -jar xalan.jar -in testFoo.xml -xsl
test.xsl -out testFooDocBook.xml)
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
__________________________
frederic heem
2007-02-06 09:58:20 UTC
Permalink
Post by Alan W. Irwin
Post by frederic heem
Hi,
It seems that ADD_DEPENDENCIES does not allow to add a dependency to
ADD_CUSTOM_TARGET(doc-test
COMMAND xmlto html
${CMAKE_CURRENT_SOURCE_DIR}/doc/CallDocBook.xml
COMMENT "generate the html documentation")
ADD_CUSTOM_TARGET(testFoo
COMMAND java -jar xalan.jar -in testFoo.xml -xsl
test.xsl -out testFooDocBook.xml)
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
ADD_CUSTOM_TARGET(testFoo ...)
ADD_CUSTOM_TARGET(doc-test ...)
ADD_DEPENDENCIES(doc-test testFoo)
thanks for the tips, but unfortunately, that's not working as expected,
running "make doc-test" results in
testFoo1
doc-test
testFoo2
doc-test
testFoo3
doc-test
etc ...

The target doc-test shall run only once at the end when all target testFoon
are executed.
Post by Alan W. Irwin
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
__________________________
_______________________________________________
CMake mailing list
http://www.cmake.org/mailman/listinfo/cmake
David Cole
2007-02-06 13:50:57 UTC
Permalink
Post by frederic heem
Post by Alan W. Irwin
ADD_CUSTOM_TARGET(testFoo ...)
ADD_CUSTOM_TARGET(doc-test ...)
ADD_DEPENDENCIES(doc-test testFoo)
thanks for the tips, but unfortunately, that's not working as expected,
running "make doc-test" results in
testFoo1
doc-test
testFoo2
doc-test
testFoo3
doc-test
etc ...
The target doc-test shall run only once at the end when all target testFoon
are executed.
Please reproduce with a small test case that you can forward to the list.
(Or send your CMakeLists...) If doc-test depends on all of the testFoo*
targets, then it should not run until *all* of the testFoo* targets have
been built. I use this technique in several projects and it works for me.
What version of CMake are you using?

Thx,
David
frederic heem
2007-02-06 15:28:37 UTC
Permalink
Hi,
Here is the test case:
top level CMakeLists.txt:

ADD_CUSTOM_TARGET(doc
COMMAND echo "doc"
COMMENT "generate the documentation")
SUBDIRS(test1)

test1 CMakeLists.txt:

ADD_CUSTOM_TARGET(test1
COMMAND echo "test1"
COMMENT "generate test1 docbook chapter")
ADD_DEPENDENCIES(doc test1)

The archive is available at
http://www.cmake.org/Bug/bug.php?op=show&bugid=4414
In which project should I have a look to get an example ?
Thanks,
Frederic Heem

PS: cmake 2.4.6
Post by David Cole
Post by frederic heem
Post by Alan W. Irwin
ADD_CUSTOM_TARGET(testFoo ...)
ADD_CUSTOM_TARGET(doc-test ...)
ADD_DEPENDENCIES(doc-test testFoo)
thanks for the tips, but unfortunately, that's not working as expected,
running "make doc-test" results in
testFoo1
doc-test
testFoo2
doc-test
testFoo3
doc-test
etc ...
The target doc-test shall run only once at the end when all target testFoon
are executed.
Please reproduce with a small test case that you can forward to the list.
(Or send your CMakeLists...) If doc-test depends on all of the testFoo*
targets, then it should not run until *all* of the testFoo* targets have
been built. I use this technique in several projects and it works for me.
What version of CMake are you using?
Thx,
David
David Cole
2007-02-06 15:39:51 UTC
Permalink
ADD_DEPENDENCIES(doc test1)

Your ADD_DEPENDENCIES command says "doc depends on test1 -- make sure the
test1 target builds first before the doc target"... Is that what you want?

If you want it the other way around, then you just need to swap the args to
ADD_DEPENDENCIES.

The CMake source tree itself has several examples of ADD_DEPENDENCIES. The
main one that popped out of my grep results is:
ADD_DEPENDENCIES(CMakeSetup cmake)

...which says "CMakeSetup depends on cmake -- make sure cmake is built
before CMakeSetup"...


HTH,
David
Post by frederic heem
Hi,
ADD_CUSTOM_TARGET(doc
COMMAND echo "doc"
COMMENT "generate the documentation")
SUBDIRS(test1)
ADD_CUSTOM_TARGET(test1
COMMAND echo "test1"
COMMENT "generate test1 docbook chapter")
ADD_DEPENDENCIES(doc test1)
The archive is available at
http://www.cmake.org/Bug/bug.php?op=show&bugid=4414
In which project should I have a look to get an example ?
Thanks,
Frederic Heem
PS: cmake 2.4.6
Post by David Cole
Post by frederic heem
Post by Alan W. Irwin
ADD_CUSTOM_TARGET(testFoo ...)
ADD_CUSTOM_TARGET(doc-test ...)
ADD_DEPENDENCIES(doc-test testFoo)
thanks for the tips, but unfortunately, that's not working as
expected,
Post by David Cole
Post by frederic heem
running "make doc-test" results in
testFoo1
doc-test
testFoo2
doc-test
testFoo3
doc-test
etc ...
The target doc-test shall run only once at the end when all target testFoon
are executed.
Please reproduce with a small test case that you can forward to the
list.
Post by David Cole
(Or send your CMakeLists...) If doc-test depends on all of the testFoo*
targets, then it should not run until *all* of the testFoo* targets have
been built. I use this technique in several projects and it works for
me.
Post by David Cole
What version of CMake are you using?
Thx,
David
______________________________________________________________________________
--- NOTICE ---
CONFIDENTIALITY - This email and any attachments are confidential and
are
intended for the addressee only. If you have received this
message by
mistake, please contact us immediately and then delete the message from
your
system. You must not copy, distribute, disclose or act upon the
contents of
this email. Thank you.
PERSONAL DATA PROTECTION (Law by Decree 30.06.2003 n. 196) - Personal
and
corporate data submitted will be used in a correct, transparent and
lawful
manner. The data collected will be processed in paper or computerized form
for
the performance of contractual and lawful obligations as well as for
the
effective management of business relationship. Data may be disclosed, in
Italy
or abroad, for the purpose above mentioned to
third parties which cooperate
with Telsey, agents, banks, factoring companies, credit recovering
companies,
credit insurance companies, professional and consultants, and
shipping
companies. In relation to the same purposes,
data may be processed by the
following classes of executors or processors: management;
administration
department; logistics and purchase department; sales department; post
sales
department quality department; R&D department; IT department; legal
department.
The data processor is Telsey S.p.A. The data subject may exercise all
the
rights set forth in art. 7 of Law by Decree 30.06.2003 n. 196 as
reported in
in the following link http://www.telsey.it/privacy.jsp.
______________________________________________________________________________
798t8RfNa6Dl8Ilf
frederic heem
2007-02-06 15:50:49 UTC
Permalink
Post by frederic heem
ADD_DEPENDENCIES(doc test1)
Your ADD_DEPENDENCIES command says "doc depends on test1 -- make sure the
test1 target builds first before the doc target"... Is that what you want?
If you want it the other way around, then you just need to swap the args to
ADD_DEPENDENCIES.
The CMake source tree itself has several examples of ADD_DEPENDENCIES. The
ADD_DEPENDENCIES(CMakeSetup cmake)
...which says "CMakeSetup depends on cmake -- make sure cmake is built
before CMakeSetup"...
Indeed, doc depends on test1, test2 ... What is asked to cmake is to build
test1, test2 before building doc. So when running "make doc", it shall
execute test1, test2 ... doc.
Actually ADD_DEPENDENCIES works when the 2 targets are declared in the same
CMakeLists.txt, it is used for instance in the precompiled header cmake
script.
Thanks
Frederic
Post by frederic heem
HTH,
David
Post by frederic heem
Hi,
ADD_CUSTOM_TARGET(doc
COMMAND echo "doc"
COMMENT "generate the documentation")
SUBDIRS(test1)
ADD_CUSTOM_TARGET(test1
COMMAND echo "test1"
COMMENT "generate test1 docbook chapter")
ADD_DEPENDENCIES(doc test1)
The archive is available at
http://www.cmake.org/Bug/bug.php?op=show&bugid=4414
In which project should I have a look to get an example ?
Thanks,
Frederic Heem
PS: cmake 2.4.6
Post by David Cole
Post by frederic heem
Post by Alan W. Irwin
ADD_CUSTOM_TARGET(testFoo ...)
ADD_CUSTOM_TARGET(doc-test ...)
ADD_DEPENDENCIES(doc-test testFoo)
thanks for the tips, but unfortunately, that's not working as
expected,
Post by David Cole
Post by frederic heem
running "make doc-test" results in
testFoo1
doc-test
testFoo2
doc-test
testFoo3
doc-test
etc ...
The target doc-test shall run only once at the end when all target testFoon
are executed.
Please reproduce with a small test case that you can forward to the
list.
Post by David Cole
(Or send your CMakeLists...) If doc-test depends on all of the testFoo*
targets, then it should not run until *all* of the testFoo* targets
have been built. I use this technique in several projects and it works
for
me.
Post by David Cole
What version of CMake are you using?
Thx,
David
_________________________________________________________________________
_____
--- NOTICE ---
CONFIDENTIALITY - This email and any attachments are confidential
and are
intended for the addressee only. If you have received this
message by
mistake, please contact us immediately and then delete the message from
your
system. You must not copy, distribute, disclose or act upon the
contents of
this email. Thank you.
PERSONAL DATA PROTECTION (Law by Decree 30.06.2003 n. 196) -
Personal and
corporate data submitted will be used in a correct, transparent and
lawful
manner. The data collected will be processed in paper or computerized
form for
the performance of contractual and lawful obligations as well as
for the
effective management of business relationship. Data may be disclosed, in
Italy
or abroad, for the purpose above mentioned to
third parties which cooperate
with Telsey, agents, banks, factoring companies, credit recovering
companies,
credit insurance companies, professional and consultants, and
shipping
companies. In relation to the same purposes,
data may be processed by the
following classes of executors or processors: management;
administration
department; logistics and purchase department; sales department; post
sales
department quality department; R&D department; IT department; legal
department.
The data processor is Telsey S.p.A. The data subject may exercise
all the
rights set forth in art. 7 of Law by Decree 30.06.2003 n. 196 as
reported in
in the following link http://www.telsey.it/privacy.jsp.
_________________________________________________________________________
_____ 798t8RfNa6Dl8Ilf
Bill Hoffman
2007-02-06 15:43:53 UTC
Permalink
Post by frederic heem
Hi,
ADD_CUSTOM_TARGET(doc
COMMAND echo "doc"
COMMENT "generate the documentation")
SUBDIRS(test1)
ADD_CUSTOM_TARGET(test1
COMMAND echo "test1"
COMMENT "generate test1 docbook chapter")
ADD_DEPENDENCIES(doc test1)
The archive is available at
http://www.cmake.org/Bug/bug.php?op=show&bugid=4414
In which project should I have a look to get an example ?
Thanks,
Frederic Heem
PS: cmake 2.4.6
Try add_subdirectory instead of SUBDIRS. SUBDIRS is an old command and
is processed last no matter its order in the file. So, cmake will not
know about test1 because the directory will not be processed until after
the add_dependencies command.

-Bill
frederic heem
2007-02-06 15:59:39 UTC
Permalink
Post by Bill Hoffman
Post by frederic heem
Hi,
ADD_CUSTOM_TARGET(doc
COMMAND echo "doc"
COMMENT "generate the documentation")
SUBDIRS(test1)
ADD_CUSTOM_TARGET(test1
COMMAND echo "test1"
COMMENT "generate test1 docbook chapter")
ADD_DEPENDENCIES(doc test1)
The archive is available at
http://www.cmake.org/Bug/bug.php?op=show&bugid=4414
In which project should I have a look to get an example ?
Thanks,
Frederic Heem
PS: cmake 2.4.6
Try add_subdirectory instead of SUBDIRS. SUBDIRS is an old command and
is processed last no matter its order in the file. So, cmake will not
know about test1 because the directory will not be processed until after
the add_dependencies command.
Whether add_subdirectory is located before or after the custom target doc,
cmake stills cannot found the doc target when processing test1/CMakeLists.txt
Regarding the subdirs command, would it be possible to emit a warning
explaining that the command is deprecated ?
Thanks,
Frederic Heem
Post by Bill Hoffman
-Bill
frederic heem
2007-02-07 16:55:57 UTC
Permalink
Hi,
The problem has been added yesterday to the bug tracker, and is already solved
in cvs, that's really amazing, thanks bill and the cmake crew !
Frederic Heem
Post by frederic heem
Post by Bill Hoffman
Post by frederic heem
Hi,
ADD_CUSTOM_TARGET(doc
COMMAND echo "doc"
COMMENT "generate the documentation")
SUBDIRS(test1)
ADD_CUSTOM_TARGET(test1
COMMAND echo "test1"
COMMENT "generate test1 docbook chapter")
ADD_DEPENDENCIES(doc test1)
The archive is available at
http://www.cmake.org/Bug/bug.php?op=show&bugid=4414
In which project should I have a look to get an example ?
Thanks,
Frederic Heem
PS: cmake 2.4.6
Try add_subdirectory instead of SUBDIRS. SUBDIRS is an old command and
is processed last no matter its order in the file. So, cmake will not
know about test1 because the directory will not be processed until after
the add_dependencies command.
Whether add_subdirectory is located before or after the custom target doc,
cmake stills cannot found the doc target when processing
test1/CMakeLists.txt Regarding the subdirs command, would it be possible to
emit a warning explaining that the command is deprecated ?
Thanks,
Frederic Heem
Post by Bill Hoffman
-Bill
_______________________________________________
CMake mailing list
http://www.cmake.org/mailman/listinfo/cmake
Continue reading on narkive:
Search results for '[CMake] ADD_DEPENDENCIES Adding dependency to non-existent target: doc-test' (Questions and Answers)
600
replies
How can an organization inspire you to get more involved in the world around you?
started 2008-01-08 11:31:23 UTC
society & culture
Loading...