[cmake-developers] target sources property

Stephen Kelly steveire at gmail.com
Thu Jun 6 11:15:34 EDT 2013


Brad King wrote:
> (2) Name the property "SOURCES" and allow projects to edit it.
> Having access to the list of sources for both reading and writing
> has been requested occasionally.  It is not safe to edit after
> reading the LOCATION property or something else that computes
> the linker language, but we already document such undefined
> behavior for LINKER_LANGUAGE and other properties.
> 
> I think I prefer option (2) because it is more general.
> 
> Either way we will have a chicken-and-egg problem of things like
> $<LINK_LANGUAGE> affecting this usage requirement which could
> bring in sources that affect the link language.

I think this is similar to the problem of adding an entry to the link 
libraries based on the value of POSITION_INDEPENDENT_CODE, which might be 
detmined by the INTERFACE_POSITION_INDEPENDENT_CODE of a dependent. That was 
solved with bf5ece51c3827dc05018128fefe8270da88cfefb (Keep track of 
properties used to determine linker libraries., 2012-11-05), which resolved 
the cycle by introducing an error. I recall a discussion about it, but I 
didn't try to find it.

I think we can do something similar in this case - Any properties used to 
determine the SOURCES have their value determined early and it will be an 
error to re-determine their value basd on the SOURCES.

> IIRC you have
> a similar problem for the WIN32_EXECUTABLE property.

You probably mean POSITION_INDEPENDENT_CODE. The only problem I have with 
the WIN32_EXECUTABLE property relates to the VS6 generator: 

 https://gitorious.org/~steveire/cmake/steveires-cmake/commit/c1bc1fecb44c36a03d33e797703bbe72d0808ff1

> Also it may be tricky due to the way $<TARGET_SOURCES:...> is
> currently handled up front.

You mean TARGET_OBJECTS? It seems to only populate a ObjectLibraries 
container which is later only used at generate-time. Or do you mean 
something else?

Thanks,

Steve.





More information about the cmake-developers mailing list