On 25. Feb, 2009, at 7:25, Philip Lowman wrote:

I'm trying to come up with a way to have a custom target defined in the
top-level directory execute a collection of custom commands previously
defined in subdirectories throughout the code (to untar many tarballs).
Unfortunately, the approach I'm trying isn't working.

When I invoke add_custom_target() immediately after add_custom_command() in the same directory, it works fine. When I invoke add_custom_target() in the
parent directory it causes an error in the makefiles.

I've attached a small example of the problem I'm having. Not sure if this
is a bug or just user error.

low...@locke:~/tmp/cmake_tests/CustomCommandProb/build$ make untar
Scanning dependencies of target untar
make[3]: *** No rule to make target `../foo-1.2.3', needed by
`CMakeFiles/untar'.  Stop.
make[2]: *** [CMakeFiles/untar.dir/all] Error 2
make[1]: *** [CMakeFiles/untar.dir/rule] Error 2
make: *** [untar] Error 2



To me this appears to be a bug in the Makefile generator. I also tried to make a "untarFoo" custom target in test/CMakeLists.txt, which depended on the output of the custom command and then have the "untar" target depend on "untarFoo", but that didn't work out either.

What works for me (CMake-CVS, Mac OS X 10.5, Makefile generator) is the following: - add an empty custom target "untar" with no dependencies to CMakeLists.txt BEFORE any of the add_subdirectory calls - in the test/CMakeLists.txt add a custom target "untarFoo" which depends on the output of the custom command - in the test/CMakeLists.txt add a dependency of the top-level "untar" target on the "untarFoo" helper target

Find attached your modified test code.

Michael

Attachment: CustomCommandProbModified.tar.gz
Description: GNU Zip compressed data


Attachment: PGP.sig
Description: This is a digitally signed message part

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to