I have a problem creating two debian packages with CPack and CMake. I've done the example from here and I did manage to create two different debian packages, but I want each of them have their own dependencies. The resultant CMakeLists.txt is the following:
cmake_minimum_required(VERSION 2.8.0) project(MyLib) add_library(mylib mylib.cpp) add_executable(mylibapp mylibapp.cpp) target_link_libraries(mylibapp mylib) install(TARGETS mylib ARCHIVE DESTINATION ~/Downloads/ComponentExampleStart/lib COMPONENT libraries) install(TARGETS mylibapp RUNTIME DESTINATION ~/Downloads/ComponentExampleStart/bin COMPONENT applications) install(FILES mylib.h DESTINATION ~/Downloads/ComponentExampleStart/include COMPONENT headers) file(WRITE dummy_main1.c "int main(int argc, char** argv){return 0;}") add_executable(dummy_main1 dummy_main1.c) INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/dummy_main1 DESTINATION /tmp COMPONENT headers OPTIONAL PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE) file(WRITE dummy_main2.c "int main(int argc, char** argv){return 0;}") add_executable(dummy_main2 dummy_main2.c) INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/dummy_main2 DESTINATION /tmp COMPONENT mylibapp OPTIONAL PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE ) SET (CPACK_GENERATOR "DEB") SET (CPACK_SOURCE_GENERATOR TGZ) SET (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) SET (CPACK_SET_DESTDIR "on") set(CPACK_DEB_COMPONENT_INSTALL ON) set(CPACK_PACKAGE_NAME "MyLib") set(CPACK_PACKAGE_VENDOR "CMake.org") set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "MyLib - CPack Component Installation Example") set(CPACK_PACKAGE_VERSION "1.0.0") set(CPACK_PACKAGE_VERSION_MAJOR "1") set(CPACK_PACKAGE_VERSION_MINOR "0") set(CPACK_PACKAGE_VERSION_PATCH "0") set(CPACK_PACKAGE_INSTALL_DIRECTORY "CPack Component Example") set(CPACK_COMPONENTS_ALL applications libraries headers) set(CPACK_COMPONENT_APPLICATIONS_GROUP "Runtime") set(CPACK_COMPONENT_LIBRARIES_GROUP "Development") set(CPACK_COMPONENT_HEADERS_GROUP "Development") set(CPACK_COMPONENT_LIBRARIES_DEPENDS "libxml2") set(CPACK_COMPONENT_HEADERS_DEPENDS "libxml2") set(CPACK_DEBIAN_PACKAGE_DEPENDS "libusb-1.0-0") SET (CPACK_PACKAGE_CONTACT "Example ") SET (CPACK_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}_${VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}") include(CPack)
(NOTE dummy_main1 and dummy_main2 make shlibdeps work, because it needs at least one executable for each package).
My objective is to create 2 different debian packages with different dependencies, say for example:
MyLib_1.0.0_amd64-Developers.deb --- depends on ---> libxml2
MyLib_1.0.0_amd64-Runtime.deb --- depends on ---> lubusb-1.0-0
but I don't find the CPACK macro to do that. I've read a lot of forums and documentation but none of that I've tested work for me. The CPACK_DEBIAN_PACKAGE_DEPENDS macro works fine, but it set the same dependencies for both packages. Is there any way to archieve my goal? I'm using CMake 2.8 to do this.
Thanks!
Well I've finally managed to isolate the dependencies. The problem was the version of CMake I was using (2.8). This can be done in lastest releases (currently using 3.3) with the CPack macro: CPACK_DEBIAN__PACKAGE_DEPENDS