[CMake] building on linux, extra libraries referenced

Michael Wild themiwi at gmail.com
Mon Dec 26 06:37:52 EST 2011


On 12/26/2011 08:46 AM, J Decker wrote:
> I have this huge project that I've been building with cmake; and even
> under gcc (mingw) I don't have this problem... but what is happening
> is I have a generic list of libraries that I provide for applications
> to link against.  This includes the c version and the c++ version of
> two libraries.  On Windows, only those libraries that are actually
> used are referenced in the final output.  On Linux, with very recent
> gcc compilers, the programs end up with references to both libraries,
> and both(all 4) libraries are loaded.  I understand that this is
> probably a feature of some sort; but now do I specify for ld to only
> use the libraries that have referenced symbols in them?

Actually, it should be just the reverse. Recent versions of Linux
(Ubuntu and Debian I know of) should have --as-needed and
--no-copy-dt-needed-entries in effect by default, causing the behaviour
you want.

Michael



More information about the CMake mailing list