[CMake] Static Linking C++ Library
Brad King
brad.king at kitware.com
Tue Sep 19 14:12:12 EDT 2006
Mike Melanson wrote:
> Brad King wrote:
>> This is not really a problem that a build system can solve directly.
>> The native build tools need to be configured to support it. In order to
>> link statically to the C++ runtime but dynamically to the C runtime and
>> other libraries you need to configure the host system properly.
>
> Would things be different (easier) if we were to link both the C and C++
> runtimes? We are evaluating that option as well.
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).
-Brad
More information about the CMake
mailing list