[CMake] COMPONENT question

Dave Flogeras dflogeras2 at gmail.com
Mon Oct 31 12:42:55 EDT 2016


Hi, are static libraries able to be added to a component?

The following minimal example doesn't work as I expected:

CMAKE_MINIMUM_REQUIRED( VERSION 3.0.0 )
PROJECT( foo )

ADD_LIBRARY( foo foo.c )
INSTALL( TARGETS foo ARCHIVE DESTINATION lib
                     RUNTIME DESTINATION bin
                     LIBRARY DESTINATION bin
                     COMPONENT bar )

INCLUDE( CPack )

If I run "make list_install_components" it says "Unspecified"

However, if I add "SHARED" to the ADD_LIBRARY call (or set
BUILD_SHARED_LIBS), it lists the component as "bar" which is what I'd
expect.

Is this a bug, or by design?  I'm attempting to figure out how I can
separate shared/static libraries in my project for different install
types.  For example, if I am packaging a binary only install, I don't need
to install static libraries, but I would need the runtime libraries.

Dave
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20161031/ef1d5d57/attachment.html>


More information about the CMake mailing list