[CMake] MACOSX_BUNDLE targets fail as custom target dependencies
Maik Beckmann
beckmann.maik at googlemail.com
Tue May 27 10:21:25 EDT 2008
Am Dienstag 27 Mai 2008 15:56:14 schrieb Brad King:
> Allan Odgaard wrote:
> > project(foo)
> > add_executable(foo MACOSX_BUNDLE main.cc)
> > add_custom_target(run_foo echo running foo DEPENDS foo)
[snip]
> > Without the MACOSX_BUNDLE setting of the target, or trying to build the
> > same project on Linux, it works.
>
> If it works on any platform it is purely by accident. That is not the
> syntax to add a target-level dependency. Try this:
>
> project(foo)
> add_executable(foo MACOSX_BUNDLE main.cc)
> add_custom_target(run_foo echo running foo)
> add_dependencies(run_foo foo)
>
> The DEPENDS option to add_custom_target adds file-level dependencies
> (for example could list the output of an add_custom_command).
> Target-level dependencies are added by add_dependencies.
Hi Brad,
I discussed this with Allan on irc. Doing it via add_dependencies was my fist
suggestion but then we apparently both confused ourself by misinterpreting
the docs:
<add_custom_command>
...If DEPENDS specifies any target (created by an ADD_* command) a
target-level dependency is created to make sure the target is built before
any target using this custom command...
</add_custom_command>
but
<add_custom_target>
...Dependencies listed with the DEPENDS argument may reference files and
outputs of custom commands created with ADD_CUSTOM_COMMAND...
</add_custom_target>
DEPENDS means different things in these different two contexts. This is what
we missed. The reason why it works on Linux maybe the fact that the custom
target and command been listed at the same CMakeLists.txt.
-- Maik
More information about the CMake
mailing list