[CMake] cpack problems.

Brad King brad.king at kitware.com
Wed May 10 14:33:41 EDT 2006


Axel Roebel wrote:
> I just tried the cpack program. It failed when executing
> a post_install_script which is configured to access the installed libraries
> and to rename them. Unfortunately this seems to be required if one wants to
> install a static and a shared library of the same name.

In CMake 2.4 you can easily create a static and shared library with the 
same name.  They just have to have different logical target names:

ADD_LIBRARY(foo SHARED ...)
ADD_LIBRARY(foo-static STATIC ...)
SET_TARGET_PROPERTIES(foo-static PROPERTIES OUTPUT_NAME foo)

Be careful when doing this on Windows though because the shared library 
will create a foo.lib export library which has the exact same name as 
the foo.lib static library.  CMake makes no attempt to diagnose or 
resolve this conflict, so it is up to the user to be sure they are 
always in different directories.

-Brad


More information about the CMake mailing list