[cmake-developers] Problems when creating config files and add_dependencies

Brad King brad.king at kitware.com
Mon Jun 22 09:17:48 EDT 2015


On 06/20/2015 04:10 AM, Roman Wüger wrote:
> but the problem with this command is, that for multi configuration
> environments (e.g. Visual Studio), it requires $<CONFIG> in the
> filename which then creates 4 header files. One for each configuration.

Yes, because generator expressions can reference things that depend
on the configuration.  configure_file does not support them because
its result does not depend on the configuration.  I guess I didn't
understand what you meant by "generator expressions can be used with
configure_file to avoid such overhead".

Returning to the original problem, the circular dependency may appear
because using $<TARGET_FILE_DIR:${projectName}> in a custom target
results in an ordering dependency on the target named in the
generator expression.  To confirm this, try hard-coding the path
by hand for one example.

-Brad



More information about the cmake-developers mailing list