[CMake] make install/strip does not strip static libraries

Kyle Leber kleber at fastemail.us
Tue Mar 27 09:45:47 EDT 2012


On Fri, Mar 23, 2012 at 4:20 PM, Kyle Leber <kleber at fastemail.us> wrote:

> Hi,
>
> I'm using cmake 2.8 and having an issue when I issue a 'make
> install/strip'.  My project includes two libraries: one static and one
> shared. The shared library gets properly stripped, but the static one does
> not.  Do I need to specify a special parameter to get the static library to
> be stripped or am I doing something else wrong?
>
> Thanks for the help!
>
> OS: Ubuntu 10.10
> Compiler: g++ 4.4.5
>
> Kyle
>

OK, I've done a little more research.  It looks like cmake_install.cmake
that is generated in my build directory has install lines handling the
shared libraries and the static libraries.

After the shared library is installed, there's a section like this:

IF(EXISTS "${file}" AND
       NOT IS_SYMLINK "${file}")
      IF(CMAKE_INSTALL_DO_STRIP)
        EXECUTE_PROCESS(COMMAND "/usr/bin/strip" "${file}")
      ENDIF(CMAKE_INSTALL_DO_STRIP)
    ENDIF()

That clearly strips the files after they are installed.  However, in the
section that installs my static library there is no such check to handle
stripping the library.  Is this a missing feature in CMake, or is there a
reason this is not supported?  I can run /usr/bin/strip on my .a static
library without issue so I think it's a reasonable thing to expect.

Any help is appreciated!  Thanks, Kyle.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120327/a3037f1d/attachment-0001.htm>


More information about the CMake mailing list