[CMake] Linking object libraries into a Windows DLL in 3.12rc1
Jason Heeris
jason.heeris at gmail.com
Tue Jun 26 08:19:57 EDT 2018
On Tue, Jun 26, 2018 at 7:36 PM, Deniz Bahadir <dbahadir at benocs.com>
wrote:
> Yes, you have overlooked an important detail. Only usage-requirements
> are transitive, the object-files are only propagated to directly
> dependent targets (not to indirectly dependent ones) *and only if
> they have a link/archive step*
Ah, for some reason I had thought object files formed part of the usage
requirements of object libraries, but that's clearly not the case.
> You need to explicitly add "module1" and "common" to the DLL's
> target_link_library call to get their object-files, too.
That's unfortunate (for me), but it is what it is I suppose. In my real
project I have about 100 modules with dependencies on each other, and I
was hoping CMake would take the work out of walking the dependency
graph and constructing the final link command. Each module has its
immediate dependencies listed, but not further than that. Resolving
them all by hand and keeping them up to date isn't really feasible.
Thanks for the explanation!
- Jason
More information about the CMake
mailing list