Instead of listing the CPack configuration settings in CMakeCPack.cmake as we have done for simplicity, we could have placed the per-generator settings of CPACK_* variables in a separate file, such as CMakeCPackOptions.cmake, and included these settings into CMakeCPack.cmake using set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_SOURCE_DIR}/CMakeCPackOptions.cmake"). This file can also be configured at CMake time and then included at CPack time, providing a clean way to configure multi-format package generators (see also: https://cmake.org/cmake/help/v3.6/module/CPack.html).
As with all tools in the CMake family, CPack is powerful and versatile and offers much more flexibility and options than what we have shown in this recipe. The interested reader should read the official documentation for the command-line interface to CPack (https://cmake.org/cmake/help/v3.6/manual/cpack.1.html) and the manual pages, which detail the additional generators that CPack knows how to use to package projects (https://cmake.org/cmake/help/v3.6/module/CPack.html).