[cmake-developers] per-config dll copying (was: Need some pointers on learning the code)

Brad King brad.king at kitware.com
Thu May 23 09:35:54 EDT 2013


On 05/22/2013 06:49 PM, Robert Dailey wrote:
> Basically I'm creating a custom target that
> depends on these output files. I have 1 custom command per
> configuration to copy these files to the configuration output
> directory, but since I cannot specify DEPENDS_<CONFIG> in
> add_custom_target(), I'm not able to specify varying numbers of
> dependencies. Could we perhaps add a DEPENDS_<CONFIG> to
> add_custom_target, so that each configuration will end up depending on
> different custom commands?

The DEPENDS option of add_custom_target is actually for
specifying which sources will be brought into the target
and driven by the build.  Since add_custom_target has no
real output its dependencies are only logical.

I think we established over here:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/6800/focus=6811

that per-config DEPENDS (and OUTPUTS) are needed even in
add_custom_command in order to hook dependencies up cleanly.

In general we've been moving away from X_<CONFIG> interfaces
and toward using just X with generator expressions, so I'd
prefer a solution like that.

However, you may be able to solve your problem by using a
simple custom target that has no dependencies and runs every
time.  In the COMMAND part, use $<CONFIGURATION> to tell a
script what configuration is building.  Then teach the script
(or custom tool, in any language) how to check the libraries
for the desired configuration and copy them if out of date.

-Brad



More information about the cmake-developers mailing list