[cmake-developers] Target usage requirements and conventions

Brad King brad.king at kitware.com
Mon May 14 14:48:49 EDT 2012


On 05/13/2012 05:50 PM, Stephen Kelly wrote:
> The remaining (I think) open question regards what form the generator 
> expressions should take so that they can represent multiple dimensions.

Multiple dimensions will inevitably need to be combined in arbitrary
boolean expressions.  I'm concerned that this will lead to a whole new
piece to the language that will be hard to get right without knowledge
of future use cases.  We will need to ensure that parsing of generator
expressions is *very* strict so we can extend the syntax easily later.

Perhaps the simplest thing to do is implement something like the normal
CMake IF() command in generator expressions.  Factor the IF() expression
evaluation out for re-use.  Teach the generator expression parser to
extract the IF() part (with nested $<> expressions already evaluated,
something the generator expression evaluator already knows how to do)
and pass it through the IF() evaluator.  For example:

  "$<IF($<CONFIGURATION> MATCHES Debug AND $<LANGUAGE> STREQUALS CXX)...>"

I'm not sure what should go in the "..." part though.  Some syntax to
delimit the then/else values would be needed.  Also the MATCHES test
is not case-insensitive, and the whole thing is quite verbose.  Ideas
welcome.

-Brad



More information about the cmake-developers mailing list