diff options
author | Rodolfo Lima <rlima@nvidia.com> | 2021-01-18 18:28:46 (GMT) |
---|---|---|
committer | Rodolfo Lima <rlima@nvidia.com> | 2021-01-26 15:23:37 (GMT) |
commit | bdf30bdad8dfad258bbc8d387a91f66bee3d0c0f (patch) | |
tree | 7b818b22b22c9e35bd04e68a851b3d39cd70bf6f /Modules/CPack.cmake | |
parent | bcdb5b52a06cb98bd09da7410488ff9d5617b27f (diff) | |
download | CMake-bdf30bdad8dfad258bbc8d387a91f66bee3d0c0f.zip CMake-bdf30bdad8dfad258bbc8d387a91f66bee3d0c0f.tar.gz CMake-bdf30bdad8dfad258bbc8d387a91f66bee3d0c0f.tar.bz2 |
CPack: add CPACK_THREADS variable to control compression threads
This allows setting how many threads the compressor will use.
Currently only implemented for XZ when using system's lzma library.
Fixes: #21715
Diffstat (limited to 'Modules/CPack.cmake')
-rw-r--r-- | Modules/CPack.cmake | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index eb1d43b..ef5a7d5 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -282,6 +282,28 @@ installers. The most commonly-used variables are: received by the cpack program. Defaults to ``FALSE`` for backwards compatibility. +.. variable:: CPACK_THREADS + + .. versionadded:: 3.20 + + Number of threads to use when performing parallelized operations, such + as compressing the installer package. + + Some compression methods used by CPack generators such as Debian or Archive + may take advantage of multiple CPU cores to speed up compression. + ``CPACK_THREADS`` can be set to positive integer to specify how many threads + will be used for compression. If it is set to 0, CPack will set it so that + all available CPU cores are used. + By default ``CPACK_THREADS`` is set to ``1``. + + Currently only ``xz`` compression *may* take advantage of multiple cores. Other + compression methods ignore this value and use only one thread. + + .. note:: + + Official CMake binaries available on ``cmake.org`` ship with a ``liblzma`` + that does not support parallel compression. + Variables for Source Package Generators ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -746,6 +768,7 @@ _cpack_set_default(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_BINARY_DIR};${CMAKE_PROJECT_NAME};ALL;/") _cpack_set_default(CPACK_CMAKE_GENERATOR "${CMAKE_GENERATOR}") _cpack_set_default(CPACK_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}") +_cpack_set_default(CPACK_THREADS 1) # if the user has set CPACK_NSIS_DISPLAY_NAME remember it if(DEFINED CPACK_NSIS_DISPLAY_NAME) set(CPACK_NSIS_DISPLAY_NAME_SET TRUE) |