Search code examples
cmakesystemd

cmake and enabling systemd service


I am installing a systemd service in my cmake file:

install(FILES test.service DESTINATION /lib/systemd/system) 

My question is how do I then enable the service automatically? i.e. systemctl enable test I could run a script to do it as part of the install but that doesn't seem right.


Solution

  • As Alex Reinking said CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA was what I needed. I also needed to run configure_file before setting CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA