MantisBT - CMake
View Issue Details
0014503CMakeCMakepublic2013-10-22 05:162016-06-10 14:31
icando 
Kitware Robot 
highfeaturealways
closedmoved 
AnyAnyAny
CMake 2.8.12 
 
0014503: Make a library can ``link to'' a objlib
Objlib is useful implementing self-registration factories, where we rely on global/static variables' constructor to register itself in a factory. The major issue is linker will remove those symbols that are not referenced, and we can use objlib to force linking these symbols.

Currently the caveat is we need to specify all objlib at add_executable, which makes it painful. It would be great if a library can specify objlib in target_link_libraries or some other new command, and it will pass those objlib all the way up to the executable, and executable will automatically include those objlibs as its source. In this way, we can maintain the alwayslink requirement where the library is defined, not at top-level.

Thanks.
No tags attached.
Issue History
2013-10-22 05:16icandoNew Issue
2013-10-22 08:30Brad KingAssigned To => Stephen Kelly
2013-10-22 08:30Brad KingStatusnew => assigned
2013-10-22 08:33Brad KingNote Added: 0034214
2013-10-22 11:41Stephen KellyNote Added: 0034216
2013-10-22 11:42Stephen KellyTarget Version => CMake 3.0
2013-10-23 04:06icandoNote Added: 0034222
2013-10-23 04:07Stephen KellyNote Added: 0034223
2013-12-04 12:23Stephen KellyTarget VersionCMake 3.0 =>
2013-12-16 18:38icandoNote Added: 0034783
2014-02-26 08:25Stephen KellyRelationship addedrelated to 0014151
2014-02-26 08:31Stephen KellyRelationship deletedrelated to 0014151
2014-03-20 11:12Stephen KellyNote Added: 0035456
2014-03-20 11:12Stephen KellyAssigned ToStephen Kelly =>
2016-06-10 14:29Kitware RobotNote Added: 0042400
2016-06-10 14:29Kitware RobotStatusassigned => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0034214)
Brad King   
2013-10-22 08:33   
Steve, will this use case be subsumed by your INTERFACE_SOURCES work?

In general it is tricky to define what tll() means for object libraries because using objects makes sense only for immediate or transitive linking but not both for a single target.
(0034216)
Stephen Kelly   
2013-10-22 11:41   
Yes, here's a relevant link:

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/7082 [^]
(0034222)
icando   
2013-10-23 04:06   
Thanks for the work. Has it been implemented in master?
(0034223)
Stephen Kelly   
2013-10-23 04:07   
Nope, not yet.
(0034783)
icando   
2013-12-16 18:38   
Looks like the target version is removed. Does it mean we can't expect it be fixed in 3.0?
(0035456)
Stephen Kelly   
2014-03-20 11:12   
Part of doing this properly would involve allowing installation, export and import of object libraries. That is currently blocked by a need to represent architecture in paths with Xcode.

 http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/9705/focus=9722 [^]
(0042400)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.