[Webinar] Streamline your web hosting managementRegister Today

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1626
  • Last Modified:

Using CMake/CPack to create a Debian package with init.d scripts

I have a CMakeLists.txt that has an additional CPack generator so that if I type "make package" it will generate a Debian package based upon the INSTALL target. This works just fine.

The binary being packaged is a daemon so as part of the package install I want to install the necessary init.d script. Unfortunately, the documentation for CMake/CPack are not wonderful and I am unable to figure out the correct way to do this such that it will install the scripts in the correct location and also not overwrite if they already exist but prompt to do so (just like one would expect if the Debian package had been created using the standard Debian package creation tools.

I could use the standard Debian package tools to do this but using CMake is so much simpler given the simplicity of the package and the fact we already have CMake build files. So my question is, is there a correct way to use CPack to install init.d scripts? This would seem a pretty fundamental thing to want to do so I am surprised I can't find how to do this.
1 Solution
evilrixSenior Software Engineer (Avast)Author Commented:
I did this in the end by just adding an INSTALL(FILES...) command.

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now