Brad King wrote:

> On 02/24/2015 05:25 PM, Stephen Kelly wrote:
>>> Until that problem is solved we cannot make object libraries
>>> implicitly offer their objects just through tll().
>> 
>> Honestly, the problem is still not clear to me.
> 
> Consider an object library with some usage requirements:
> 
>  add_library(objlib OBJECT ...)
>  target_compile_definitions(objlib PUBLIC MYDEF)
> 
> Now try using that library and assume that tll() takes the objects
> without explicit $<TARGET_OBJECTS:objlib> in the sources:
> 
>  add_library(mylib SHARED ...)
>  target_link_libraries(mylib PUBLIC objlib)
> 
> We link publicly to forward the usage requirements of objlib through
> mylib.  Now consumers of mylib will get objlib's objects too.  That
> is not desired.  It is the same problem as transitive interface
> sources.

Ok, I see. Now I also understand Bens commit message referenced at the 
beginning of the thread:

    The real fix is to make INTERFACE_SOURCES only applicable when
    directly linked and not transitive, but that is a bigger change.


> What I envision for the future is:
> 
>  add_library(objlib OBJECT ...)
>  target_compile_definitions(objlib PUBLIC MYDEF)
>  target_sources(objlib INTERFACE $<TARGET_OBJECTS:objlib>)

Do you envision that as the idiomatic way to declare object libraries? Would 
CMakeLists authors have to write the target_sources line explicitly, if this 
future becomes possible?

Thanks,

Steve.



-- 

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

Reply via email to