[CMake] Static Linking C++ Library

Mike Melanson mike at multimedia.cx
Tue Sep 19 14:20:26 EDT 2006


Brad King wrote:
> You can link the entire program statically if you don't have any of your
> own shared libraries.  Then running "ldd myexe" will produce a message
> that the executable is not dynamically linked.  This requires just
> adding "-static" to CMAKE_EXE_LINKER_FLAGS (or the appropriate option
> for your compiler).

Sounds simple enough. Except that there are 2 build targets for this 
project that embody most of the same functionality: A static executable 
and a shared library that other programs can call. That shared library 
changes the rules a bit, doesn't it?

	Thanks...
-- 
	-Mike Melanson


More information about the CMake mailing list