11.4. Installing a Shared Library

If a shared library is created with the $SHLIBVERSION variable set, scons will create symbolic links as needed based on that variable. To properly install such a library including the symbolic links, use the InstallVersionedLib function.

For example, on a Linux system, this instruction:

foo =  env.SharedLibrary(target="foo", source="foo.c", SHLIBVERSION="1.2.3")
    

Will produce a shared library libfoo.so.1.2.3 and symbolic links libfoo.so and libfoo.so.1 which point to libfoo.so.1.2.3. You can use the Node returned by the SharedLibrary builder in order to install the library and its symbolic links in one go without having to list them individually:

env.InstallVersionedLib(target="lib", source=foo)
    

On systems which expect a shared library to be installed both with a name that indicates the version, for run-time resolution, and as a plain name, for link-time resolution, the InstallVersionedLib function can be used. Symbolic links appropriate to the type of system will be generated based on symlinks of the source library.