[CMake] Question about linking

Tyler Roscoe tyler at cryptio.net
Fri Jun 5 14:02:45 EDT 2009


On Fri, Jun 05, 2009 at 10:43:44AM -0700, Kaveh Kohan wrote:
> 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

Shared libraries and static libraries are different in a very
fundamental way. CMake cannot simply convert one to the other.

If you want your executable to use static libraries, you must build all
those libraries statically, then link your executable with those static
libraries. add_library() takes a STATIC option, so if you are building
all the libs yourself you may just need to add that flag to each
library's add_library() call.

tyler


More information about the CMake mailing list