[cmake-developers] Object library linking (and a bit about INTERFACE_SOURCES)

Stephen Kelly steveire at gmail.com
Wed Feb 25 17:45:47 EST 2015


Ben Boeckel wrote:

> On Wed, Feb 25, 2015 at 22:57:13 +0100, Stephen Kelly wrote:
>> > 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?
> 
> It would be nice if that's the pattern anyways. 

...

>> Would CMakeLists authors have to write the target_sources line
>> explicitly, if this future becomes possible?
> 
> No ...

But then the idiomatic way would be 

 add_library(objlib OBJECT ...)
 target_compile_definitions(objlib PUBLIC MYDEF)

Right? Not the above which also includes a target_sources call, right?

Thanks,

Steve.




More information about the cmake-developers mailing list