[CMake] Cross-directory dependencies?

Brad King brad.king at kitware.com
Tue Dec 11 09:04:07 EST 2007


Bryan O'Sullivan wrote:
> I have two sibling directories.  In one of them, a binary is built, and
> in the other, that binary is packaged up using a custom command.  Is
> there a way in the DEPENDS clause to express this dependency?

There are two levels of dependencies: file and target.  File-level
dependencies are evaluated within each target to actually update the
build.  Target-level dependencies make sure that entire targets are up
to date before others even begin building (or evaluating file-level
dependencies).

Target-level dependencies are good across directories too.  You should
just be able to do

  add_dependencies(my_packager_target my_exe_target)

in the directory with the custom command/target that does the packaging.

-Brad


More information about the CMake mailing list