[CMake] Fwd: Removing overkill linking

Hendrik Sattler post at hendrik-sattler.de
Sun Oct 3 12:15:13 EDT 2010


Am Sonntag 03 Oktober 2010, 14:15:41 schrieb Paul McEnery:
> The solution was to set CMAKE_EXE_LINKER_FLAGS using "-Wl,--as-needed".

That is actually only a work-around. Pkg-config can handle the difference 
between static linking and dynamic linking but you have to tell it what is 
what. However, not all upstream developers that emit pkg-config files make 
proper use of that.

OTOH, some APIs import types from other libraries so that linking to those is 
necessary to avoid problems when upgrading. That's where -Wl,--as-needed is 
not the proper solution (as the linker cannot know this).

HS


More information about the CMake mailing list