On 02/23/2015 07:50 PM, Ben Boeckel wrote:
> We could also lift the restriction then. I'm fine with just dropping the
> patch. Basically without it, all it blocks is
> add_custom_{command,target} from using $<TARGET_OBJECTS>…which could be
> useful for some obscure linker target CMake doesn't understand. So maybe
> just lifting all such restrictions on $<TARGET_OBJECTS> is the thing to
> do.Some restrictions are there because we cannot safely evaluate the $<TARGET_OBJECTS> in general for all generators. See the code using EvaluateForBuildsystem. >> I had imagined other cases which were easy to reason about (and probably >> more common to need) such as: >> >> target_sources(a INTERFACE >> $<$<STREQUAL:$<TARGET_PROPERTY:TYPE>,EXECUTABLE>sym1.c> >> ) >> >> So that it would just 'pass through' any intermediate libraries. > > That works for that case, but doesn't work when it needs to land in a > specific shared or static library (though I suppose STREQUAL + > TARGET_NAME could work there too, but that doesn't feel clean to me and > also feels like the tail wagging the dog). The author of the target_sources call likely has no idea what consumer really wants the sources. At most one could do something like: target_sources(someLib INTERFACE $<$<BOOL:$<TARGET_PROPERTY:GIVE_ME_someLib_SOURCES>>:someLib.c>) with current functionality. Until that problem is solved we cannot make object libraries implicitly offer their objects just through tll(). That is the reason I chose to use explicit $<TARGET_OBJECTS> in sources in the first place. It avoids the transitive multiple-use problem. The transitivity problem is also the reason I disallowed linking to/from object libraries originally. >> I thought about denying INTERFACE_SOURCES to objlibs altogether >> but decided against it since the same thing can be done with >> other libraries anyways. We should either solve this problem now or disallow the INTERFACE_SOURCES of object libraries. Then we will have the freedom in the future to allow it with whatever semantics make sense when the problem is eventually solved. The difference between object libraries and other library types is that the former have no usage requirements yet so this is all new behavior for them anyway. When the problem is solved then we can activate INTERFACE_SOURCES for object libraries and allow addition of $<TARGET_OBJECTS:self> to it. -Brad -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers
