CPack is an external tool allowing the fast packaging of built CMake projects by gathering all the required data straight from the CMakeLists.txt
files and the utilized installation commands like install_targets()
.
For CPack to properly work, the CMakeLists.txt
must include files or targets to be installed using the install
build target.
A minimal script could look like this:
# Required headers
cmake(3.0)
# Basic project setup
project(my-tool)
# Define a buildable target
add_executable(tool main.cpp)
# Provide installation instructions
install_targets(tool DESTINATION bin)