[cmake-developers] conditionals in generator expressions

Brad King brad.king at kitware.com
Mon May 28 11:00:34 EDT 2012


On 05/25/2012 05:18 PM, Stephen Kelly wrote:
> By the way, another thing we would need to cover with this is linking to 
> another library based on the value of a property. 
> 
> https://codereview.qt-project.org/#change,26577

That one doesn't have to be delayed until generation time, but if we
did have generate-time conditionals they could be used for this.
We're in agreement that this is turning into a declarative spec.
If we keep the evaluation of it at generate time then there is no
chance that imperative logic will conflict because the imperative
part runs only during the configuration step.

> I thought maybe we can discard the idea of using generator expressions built 
> into the property content, and introduce a new finalize() command similar to 
> macro() and function():

It would have to run once for each configuration to be generated
and receive said configuration as an argument.  The implementation
would have to fork the entire representation into independent
per-configuration branches (cmMakefile, cmTarget, etc.).  It would
also allow imperative logic after the end of configuration or during
generation time which should be avoided for the reason above.

-Brad



More information about the cmake-developers mailing list