CPACK(1)

πŸ’… CPACK(1) πŸ’…

ok so real talk, this is the manual page for cpack from the CMake fam β€” we're doing the CMake version of it, bestie, and this is part one of three so buckle up πŸŽ€


✨ NAME ✨

cpack β€” the CPack Command-Line Reference, aka your girl's whole personality in one executable πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

cpack [<options>]

that's it. that's the whole vibe. <options> go brrr ✨


🌸 DESCRIPTION 🌸

okay so the cpack executable is literally the CMake packaging program. She generates installers and source packages in a whole variety of formats β€” it's giving range, it's giving versatility, we love to see it πŸ‘‘

For each installer or package format, cpack has a specific backend, and that backend is called a "generator". A generator is the one responsible for generating the required inputs and then invoking the specific package creation tools. So like, she's not doing the manual labour herself, she's the project manager πŸ’…

⚠️ important heads up: these installer or package generators are not to be confused with the makefile generators of the cmake command. different creatures, different lore, iykyk πŸ™ˆ

All supported generators are specified in the cpack-generators manual. And listen β€” the command cpack --help prints a list of generators supported for the target platform, so if you're ever lost, just ask her nicely and she'll tell you 🫢

Which of them are actually gonna be used? That's selectable through the CPACK_GENERATOR variable, or through the command-line option -G. two ways to say the same thing, pick your fighter ⭐

The cpack program is steered by a configuration file written in the CMake language. Unless you choose differently through the command-line option --config, the file CPackConfig.cmake in the current directory is the one that gets used. default behavior, no cap πŸ’œ

And in the standard CMake workflow? The file CPackConfig.cmake is generated by the cmake executable, provided that the CPack module is included by the project's CMakeLists.txt file. so like, the whole ecosystem is linking arms and holding hands, it's very main character energy 🌈


part two is coming, don't go anywhere bestie 🧚

✨ OPTIONS ✨

okay bestie, this is the part where we meet all the flags πŸ’… every single one is here, no skips, no cap.


  • -G <generators> β€” so <generators> is a semicolon-separated list of generator names (the cmake-language-lists kind, iykyk). cpack will literally iterate through this list and produce package(s) in that generator's format, according to the deets you gave it in the CPackConfig.cmake configuration file. If you don't pass this option, the CPACK_GENERATOR variable decides the default set of generators that get used. πŸŽ€
  • -C <configurations> β€” tells cpack which project configuration(s) to package (think Debug, Release, etc.), where <configurations> is a semicolon-separated list. When your CMake project uses a multi-configuration generator like Xcode or Visual Studio, you need this option so cpack knows which built executables to include in the package. And heads up: you are responsible for making sure the configuration(s) you listed have already been built before you invoke cpack. No blaming cpack later 😭
  • -D <var>=<value> β€” sets a CPack variable, and it overrides any value <var> had in the input file that cpack read. 🫢
Added in version 4.0: the single-argument form -D<var>=<value> is now supported. slay.
  • --config <configFile> β€” picks the configuration file cpack reads for all the packaging details. Default? CPackConfig.cmake in whatever directory you're standing in. πŸ’–
  • -V, --verbose β€” runs cpack with verbose output. This one shows you more details from the package generation tools and is suitable for project developers. ✨
  • --debug β€” runs cpack with debug output. This is mainly for the developers of cpack itself, ngl, and is not normally needed by project developers. πŸ™ˆ
  • --trace β€” puts the underlying cmake scripts in trace mode.
  • --trace-expand β€” puts the underlying cmake scripts in expanded trace mode. (yes, expanded. it's giving extra.)

  • -P <packageName> β€” overrides/defines the value of the CPACK_PACKAGE_NAME variable used for packaging. Any value set for this variable in the CPackConfig.cmake file will then be ignored. πŸ‘‘
  • -R <packageVersion> β€” overrides/defines the value of the CPACK_PACKAGE_VERSION variable used for packaging. It'll override a value set in the CPackConfig.cmake file, or one automatically computed from CPACK_PACKAGE_VERSION_MAJOR, CPACK_PACKAGE_VERSION_MINOR and CPACK_PACKAGE_VERSION_PATCH. πŸ’…
  • -B <packageDirectory> β€” overrides/defines CPACK_PACKAGE_DIRECTORY, which controls the directory where CPack does its packaging work. The resultant package(s) will be created at this location by default, and a _CPack_Packages subdirectory will also be created below this directory to use as a working area during package creation. πŸŽ€
  • --vendor <vendorName> β€” overrides/defines CPACK_PACKAGE_VENDOR. easy.
  • --preset <preset>, --preset=<preset> β€” uses a package preset to specify package options. The project binary directory is inferred from the configurePreset key. πŸ¦‹
Changed in version 4.4: if --presets-file is specified, neither CMakePresets.json nor CMakeUserPresets.json are required to be present. Otherwise, they are required to be present in the top level source directory. In prior versions, this was strictly required. πŸ’€
  • --presets-file <file>, --presets-file=<file> β€” Added in version 4.4. Reads presets from the given <file>. The specified path may be absolute or relative to the current working directory. If --presets-file is given, presets defined in CMakePresets.json and CMakeUserPresets.json will be ignored. 🫢
  • --list-presets β€” lists the available package presets. 🌸
Changed in version 4.4: if --presets-file is specified, neither CMakePresets.json nor CMakeUserPresets.json are required to be present, and only presets defined in the given <file> will be listed. Otherwise, they are required to be present in the top level source directory. In prior versions, this was strictly required. 😭

  • -version[=json-v1] [<file>], --version[=json-v1] [<file>], /V[=json-v1] [<file>], /version[=json-v1] [<file>] β€” show the program name/version banner and exit. If json-v1 is specified, it prints extended version information in JSON format. The JSON output contains the versions for the CMake and its dependencies. The output is printed to a named <file> if given. ⭐

The JSON output format is described in machine-readable form by this JSON schema.

  • -h, -H, --help, -help, -usage, /? β€” print usage information and exit. Usage describes the basic command line interface and its options. iconic.

the help-flag cinematic universe πŸ’–

ngl this next cluster is huge but bestie it's all real:

  • --help <keyword> [<file>] β€” print help for one CMake keyword. <keyword> can be a property, variable, command, policy, generator or module. The relevant manual entry for <keyword> is printed in a human-readable text format. The output is printed to a named <file> if given.
Changed in version 3.28: prior to CMake 3.28, this option supported command names only. glow-up fr.
  • --help-full [<file>] β€” print all help manuals and exit. All manuals are printed in a human-readable text format. The output is printed to a named <file> if given. all of them. every single one. πŸ’€
  • --help-manual <man> [<file>] β€” print one help manual and exit. The specified manual is printed in a human-readable text format. The output is printed to a named <file> if given.
  • --help-manual-list [<file>] β€” list help manuals available and exit. The list contains all manuals for which help may be obtained by using the --help-manual option followed by a manual name. The output is printed to a named <file> if given.
  • --help-command <cmd> [<file>] β€” print help for one command and exit. The cmake-commands(7) manual entry for <cmd> is printed in a human-readable text format. The output is printed to a named <file> if given.
  • --help-command-list [<file>] β€” list commands with help available and exit. The list contains all commands for which help may be obtained by using the --help-command option followed by a command name. The output is printed to a named <file> if given.
  • --help-commands [<file>] β€” print the cmake-commands manual and exit. The cmake-commands(7) manual is printed in a human-readable text format. The output is printed to a named <file> if given.
  • --help-module <mod> [<file>] β€” print help for one module and exit. The cmake-modules(7) manual entry for <mod> is printed in a human-readable text format. The output is printed to a named <file> if given.
  • --help-module-list [<file>] β€” list modules with help available and exit. The list contains all modules for which help may be obtained by using the --help-module option followed by a module name. The output is printed to a named <file> if given.
  • --help-modules [<file>] β€” print the cmake-modules manual and exit. The cmake-modules(7) manual is printed in a human-readable text format. The output is printed to a named <file> if given.
  • --help-policy <cmp> [<file>] β€” print help for one policy and exit. The cmake-policies(7) manual entry for <cmp> is printed in a human-readable text format. The output is printed to a named <file> if given.
  • --help-policy-list [<file>] β€” list policies with help available and exit. The list contains all policies for which help may be obtained by using the --help-policy option followed by a policy name. The output is printed to a named <file> if given.
  • --help-policies [<file>] β€” print the cmake-policies manual and exit. The cmake-policies(7) manual is printed in a human-readable text format. The output is printed to a named <file> if given.
  • --help-property <prop> [<file>] β€” print help for one property and exit. The cmake-properties(7) manual entries for <prop> are printed in a human-readable text format. The output is printed to a named <file> if given. (yes, entries plural, lowkey iconic)
  • --help-property-list [<file>] β€” list properties with help available and exit. The list contains all properties for which help may be obtained by using the --help-property option followed by a property name. The output is printed to a named <file> if given.
  • --help-properties [<file>] β€” print the cmake-properties manual and exit. The cmake-properties(7) manual is printed in a human-readable text format. The output is printed to a named <file> if given.
  • --help-variable <var> [<file>] β€” print help for one variable and exit. The cmake-variables(7) manual entry for <var> is printed in a human-readable text format. The output is printed to a named <file> if given.
  • --help-variable-list [<file>] β€” list variables with help available and exit. The list contains all variables for which help may be obtained by using the --help-variable option followed by a variable name. The output is printed to a named <file> if given.
  • --help-variables [<file>] β€” print the cmake-variables manual and exit. The cmake-variables(7) manual is printed in a human-readable text format. The output is printed to a named <file> if given. πŸ§šπŸ’œ

✨ SEE ALSO ✨

Okay bestie, you're not alone in this, there's literally a whole community out here 🫢 Here's where to go when you need help with CMake:

πŸ’– Home Page

https://cmake.org

This is the main character starting point if you wanna learn about CMake. Periodt. πŸ‘‘

🌈 Online Documentation and Community Resources

https://cmake.org/documentation

All the links to the docs and community resources are chilling on this web page β€” go click around, it's giving resource hub ✨

πŸ¦‹ Discourse Forum

https://discourse.cmake.org

The Discourse Forum is where all the discussions and questions about CMake live. If you've got a question, this is the spot, no cap πŸ’¬


2000-2026 Kitware, Inc. and Contributors

Like, respect to Kitware and everybody who contributed, fr fr πŸ’œ


And that's the whole page, bestie! This was version 4.4.5, dated Oct 28, 2026 β€” screenshot it, bookmark it, tattoo it on your forearm, whatever works for you πŸ’…βœ¨ Go forth and package something iconic πŸ“πŸŒΈ

πŸ“¦ where this page comes from