[CMake] Question about linking

Denis Scherbakov denis_scherbakov at yahoo.com
Mon Jun 8 03:21:19 EDT 2009




> I am relatively newbie to CMake community. I have a
> question and I would be thankful if anybody answers. I do
> apologize in advance if my question is too naive. I have a
> project created by Cmake. It produces an executable which is
> linked to many shared and static libraries. I am wondering
> what is the cmake option which brings all libraries
> including shared and static libraries inside of the
> executable and make it independent of other libraries. In
> the other words, I would like my final release to be
> independent of all .so (shared libraies). First of all, I
> would like to know whether it is possible or not and it it
> is how I can do that.  I have tried following but they
> didn't work:

In addition to previous suggestion, you need to use CMAKE_EXE_LINKER_FLAGS
and add static flag there. (If you're using GCC, it is -static.)

All libraries that your program uses must have static equivalents.

Denis


      


More information about the CMake mailing list