[CMake] CPack, Debian packages and libraries

Benjamin Kloster benjamin.kloster at videlco.eu
Wed Oct 17 08:44:59 EDT 2012


Hi everyone,
I'm trying to configure CPack for packaging an executable and some 
shared libraries the application depends on. Both application and 
libraries are built by CMake. For NSIS, this works just fine, the 
installer includes all necessary files. However, the CPack Debian 
generator seems to only include the executable in the package, but not 
the shared libraries. Unfortunately, static linking is not an option due 
to licensing issues.

I've put some excerpts of the CMakeLists.txt files and CPack 
configuration below.

Some observations:
- Adding another executable target to the package works fine, only 
library targets are affected
- Miscellaneous files installed with INSTALL(FILES ...) are properly 
included in the debian package
- "make install" installs the shared libraries, as it should
- As mentioned above, (almost) the same configuration works fine for the 
CPack NSIS generator
- playing around with the DESTINATION arguments of the libraries' 
install commands didn't help

Am I missing something obvious? Doesn't the CPack .deb generator support 
packaging of pre-compiled libraries?

Thanks for any help,
Ben

###############################################################
# CMakeLists.txt and CPack configuration file in excerpts
###############################################################

# One of the  libraries
add_library(gdcp SHARED ${SOURCES} ${PUBLIC_HEADERS} ${PRIVATE_HEADERS} )

install(
     TARGETS gdcp
     LIBRARY DESTINATION lib
     RUNTIME DESTINATION bin
     COMPONENT gdcp_lib
)

# The executable
add_executable(gdcp_browser
     ${SOURCES}
     ${HEADERS}
)

install(
     TARGETS gdcp_browser
     RUNTIME DESTINATION bin
     COMPONENT gdcp_browser
)

And part of the CPack configuration file I use for the Debian package:

SET(CPACK_CMAKE_GENERATOR "Unix Makefiles")
SET(CPACK_GENERATOR "DEB")
SET(CPACK_INSTALL_CMAKE_PROJECTS
     "@CMAKE_BINARY_DIR@;gdcp;gdcp_browser;/"
     "@CMAKE_BINARY_DIR@;gdcp;gdcp_lib;/"
)
...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121017/e12013ff/attachment-0001.htm>


More information about the CMake mailing list