[CMake] Add libraries to end of compilation line ...

Michael Burns mburns83 at yahoo.com
Wed Jun 25 13:46:59 EDT 2014


Hello, all.

I work on a cross-platform project that has many libraries and several
applications. CMake on Linux naturally adds the TARGET_LINK_LIBRARIES
specified in the libraries after those specified in the
TARGET_LINK_LIBRARIES for the application. However, there are several
common system libraries, for example pthread, that are used by many of
the libraries and most of the applications.

The current scripts only have the common system libraries specified in a
few scattered places. And, it works. However, we're trying to change to
statically link these libraries and the links are failing with
"undefined reference" errors. When I manually modify link.txt to add the
various system libraries to the end of the compilation line, it works.
So, rather than going through all of the scripts (of which there are
many), I would like to be able to list them so they are added to the end
of every link.

Is there a way to identify libraries in such a way that they are added
to the end of the compilation line rather than having to add those
libraries to every library and application that requires them?

Thanks!

Mike


More information about the CMake mailing list