[CMake] problem with add_custom_command / add_custom_target in different directories

Philip Lowman philip at yhbt.com
Wed Feb 25 01:25:45 EST 2009


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.

lowman at 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

-- 
Philip Lowman
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090225/f70d8d01/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CustomCommandProb.tar.gz
Type: application/x-gzip
Size: 808 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090225/f70d8d01/attachment.bin>


More information about the CMake mailing list