How it works

CPack can be used to generate many different types of packages for distribution. When generating the build system, the CPack instructions we listed in CMakeCPack.cmake are used to generate a CPackConfig.cmake file in the build directory. When running the CMake command for the package or package_source targets, CPack is automatically invoked with the autogenerated configuration file as argument. Indeed, these two new targets are simple rules that wrap calls to CPack. Much as CMake, CPack also has a concept of generators. Whereas generators in the context of CMake are the tools that will be used to generate the native build scripts, for example, Unix Makefiles or Visual Studio project files, in the context of CPack these are the ...

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.