[cmake-developers] Generator expressisons in target properties (was Re: conditionals in generator expressions)

Stephen Kelly steveire at gmail.com
Fri Oct 26 06:10:45 EDT 2012


Stephen Kelly wrote:
> The topics use-generator-target and target-location-configure-time don't
> depend on anything or each other, so I can work on merging them when
> development opens again.
> 
> After that export-at-generate-time can be rewritten.
> 
> After that I'll get the contents of use-generator-target-2 in, probably
> split into multiple topics so that the nightlies feedback stays managable.
> 
> Then we can return to the link depends issues, followed by everything
> else.

I thought about this a little bit and looked into the code, and I'm not sure 
it's a good plan. Making export() at generate time work means that the whole 
functionality needs to be available through cmTarget, and that means that 
almost all of the use-generator-target-2 branch would need to be copying 
instead of moving. 

To reduce code duplication it might be possible to use templates, but 
because the API would need to remain on cmTarget, there wouldn't be any 
compile-time guard by having the API also on cmGeneratorTarget. It might be 
possible to make some of the API in cmTarget private, but that would require 
template-friends, and I doubt the dashboard is ok with that. It also 
wouldn't solve the whole problem anyway as it's still accessible from 
cmTarget (this means that it's easier to add features similar to the 
LOCATION property). So, the requirement to access linking-related 
information makes it not worth moving to cmGeneratorTarget.

So, I'm now thinking that a better solution would be to port the 
cmGeneratorExpression API back to cmTarget, and have run-time determination 
of whether to strip or process the link-related properties.

The new plan would be:

* Port cmGeneratorExpression API to cmTarget
* Add a way to determine at runtime whether linking-related information is 
being requested at configure-time or generate-time. A property on the 
Makefile might work.
* Add a const char *config where appropriate to cmTarget API to pass to the 
generator expressions.
* Return to the depends issue and everything else.

Any thoughts on that? Have I missed something?

Steve.





More information about the cmake-developers mailing list