This project uses CPack to create an RPM containing a systemd service. I'm a novice when in comes to creating RPMs- caveat emptor.
Here's a utilitarian user's guide:
# Clone, build, and package the project.
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/opt/hello-world-service
make package
# Go ahead and install the RPM.
ls *.rpm
yum install ./hello-world-0.1-Linux.rpm
# Check the status of the service - should be stopped.
systemctl status hello-world
# Start the service, then check its status.
systemctl start hello-world
systemctl status hello-world
# Removing the RPM should cleanup all traces.
yum remove hello-world
systemctl status hello-world
This project was fixed to support upgrades to the RPM package. If you're creating your own RPMs, I strongly recommend testing the upgrade process before shipping.