[cmake-developers] Arbitrary content in JOIN genex separator

Stephen Kelly steveire at gmail.com
Tue Apr 23 15:26:20 EDT 2013


Hi,

I've (force) pushed the join-genex branch to my clone. It implements the 
generator expression

 $<JOIN:list,sep>

such that the result is

 sep<element1>sep<element2>...sep<elementN>

This is part of the work to make it possible to refer to properties of 
targets before the target is defined:

 qt4_generate_moc(
   ${input_file}
   ${moc_file}
   TARGET foo # Use the includes and defines from foo
 )

 add_executable(foo ${input_file} ${moc_file})
 target_link_libraries(foo Qt5::Widgets)

The implementation of qt4_generate_moc would be updated to do something like

 -I$<JOIN:$<TARGET_PROP:${target},INCLUDE_DIRECTORIES>,-I>

to generate the -I arguments to pass to moc.

A $<UNIQ:list> generator expression could also be added to solve the issue 
in

 http://public.kitware.com/Bug/view.php?id=14094

The $<JOIN> branch is almost ready, but I thought something worth bringing 
up is the use of a comma as a separator. Because the comma is a part of the 
genex syntax, the $<COMMA> expression must be used:

 $<JOIN:one;two;three,$<COMMA>> # results in one,two,three

For the $<1:...> generator expression, the comma is unambiguously allowed in 
the '...' section because we know there is only one parameter. Similarly, 
for $<JOIN:list,sep> I could allow the sep to be 'arbitrary content' by 
considering the first comma to be a genex syntax, and all following commas 
to be part of the separator.

 $<JOIN:one;two;three,,> # results in one,two,three

Do you think that's more or less confusing? Should I implement it?

Thanks,

Steve.





More information about the cmake-developers mailing list