On 06/06/2013 10:41 AM, Stephen Kelly wrote: > Brad King wrote: >> Instead let's consider introducing a usage requirement that can bring >> in object libraries, external objects, or even source files. That >> would solve this and be pretty cool too. > > There's no existing API for manipulating the source items of a target after > its creation, so I thought that would be disallowed for some reason. > > So, what we're talking about is something like a target property > SOURCE_ITEMS? > > # Only appending to this property allowed: > set_property(TARGET foo APPEND PROPERTY > SOURCE_ITEMS > $<TARGET_OBJECTS:bar> > somefile.cpp > somecompileobject.o > ) > > and a corresponding INTERFACE_SOURCE_ITEMS which gets consumed from the link > interface?
Yes, something like this is what I had in mind. I do not think we need the "append only" requirement. Instead we have two options: (1) Name the property "EXTRA_SOURCES" and do not expose the original sources at all so editing is not a problem. (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. IIRC you have a similar problem for the WIN32_EXECUTABLE property. Also it may be tricky due to the way $<TARGET_SOURCES:...> is currently handled up front. -Brad -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
