To create a package using a specific format, it is possible to pick the Generator to be used.
Similar to CMake this may be done using the -G argument:
cpack -G 7Z .
Using this command line would package the built project in the current directory using the 7-Zip archive format.
At the time of writing, CPack version 3.5 supports the following generators by default:
7Z7-Zip file format (archive)
IFWQt Installer Framework (executable)
NSISNull Soft Installer (executable)
NSIS64Null Soft Installer (64-bit, executable)
STGZSelf extracting Tar GZip compression (archive)
TBZ2Tar BZip2 compression (archive)
TGZTar GZip compression (archive)
TXZTar XZ compression (archive)
TZTar Compress compression (archive)
WIXMSI file format via WiX tools (executable archive)
ZIPZIP file format (archive)
If no explicit generator is provided, CPack will try to determine the best available depending on the actual environment. For example, it will prefer creating a self-extracting executable on Windows and only create a ZIP archive if no suitable toolset is found.