Search code examples
cmakedebiandebcpacksoftware-packaging

Separating symbolic links in CPack for deb generation


I am trying to generate deb packages in CMake. The problem is, I am having trouble separating out the symbolic links so that it matches the standard conventions for Debian packages:

  • lib<name>.deb
    • /usr/lib/<name>.so.<major version>.<minor version>
    • /usr/lib/<name>.so.<major version> -> sim link to first
  • lib<name>-dev.deb
    • /usr/lib/<name>.so -> sim link to first
    • /usr/include/<name>.h

What I am wondering is, how can I separate the sym links out using CPack's DEB generator? Is there a way of putting the symbolic link in a different COMPONENT?

Thanks


Solution

  • Someone on IRC (#cmake@freenode) pointed out that I could use NAMELINK_ONLY for one install command and have a duplicate install with NAMELINK_SKIP. Then, if I specify different COMPONENTs for each, it has the behavior I'm looking for.

    Example:

    install(TARGETS project
            LIBRARY
            DESTINATION lib
            COMPONENT runtime
            NAMELINK_SKIP
    )
    
    install(TARGETS project
            LIBRARY
            DESTINATION lib
            COMPONENT dev
            NAMELINK_ONLY
    )