[CMake] Adding dependencies for static libraries

Titus von Boxberg titus at v9g.de
Tue Oct 16 13:11:03 EDT 2012


Am 16.10.2012 17:53, schrieb Robert Bielik:
> Titus von Boxberg skrev 2012-10-16 13:20:
>> Actually, "target_link_libraries(C B)" puts B into the
>> Additional Dependencies of the VC project generated for C.
>
> Unfortunately that doesn't cut it. target_link_libraries adds the build
> dependency, but it does not list the lib files in "Additional
> Dependecies", which I think shuld be default behavior with static
> libraries (just as it does for a shared library).
Well, I'm using target_link_libraries and it does what I described:
Add the libraries to Additional Dependencies of the EXE project.

>
> I'll file a bug report for this. My whole aim is to be able to create a
> single static library file that contains everything it needs, so that an
> executable linking statically won't have to bother. Using a shared
> library is an option, but we'd like to be able to offer customers both
> dynamic and static linking options.
That wasn't clear from your first post.
I doubt that this is the intended behaviour of target_link_libraries.
If you want the librarian to combine A and B into a single A+
than you might as well add a post build step of A to do so.

Regards
Titus


More information about the CMake mailing list