diff options
author | Nils Gladitz <nilsgladitz@gmail.com> | 2021-04-19 17:37:57 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-04-22 19:40:13 (GMT) |
commit | c5c130e675624eef03f5bcaf848810659e205ed2 (patch) | |
tree | ab057134a2452170450b06777f0149f1d6d8ad53 /Modules | |
parent | 5380d858ff4cb21ae1a8777a9b721af97f598c37 (diff) | |
download | CMake-c5c130e675624eef03f5bcaf848810659e205ed2.zip CMake-c5c130e675624eef03f5bcaf848810659e205ed2.tar.gz CMake-c5c130e675624eef03f5bcaf848810659e205ed2.tar.bz2 |
cmArchiveWrite: Consolidate multiple ways to set thread count
Merge use of SetFilterOption() into more abstract thread count
in cmArchiveWrite constructor.
libarchive defaulting of threads for threads == 0 seems to be
configuration dependent. Preemptively default thread count via
std::thread::hardware_concurrency().
Also allow negative values for the thread count in which case
the detected hardware concurrency is also used but the given
absolute thread count is used as an upper limit.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CPack.cmake | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 3b29ede..373a707 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -291,13 +291,21 @@ installers. The most commonly-used variables are: 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. + ``CPACK_THREADS`` can be set to specify how many threads will be + used for compression. + + A positive integer can be used to specify an exact desired thread count. + + When given a negative integer CPack will use the absolute value + as the upper limit but may choose a lower value based on + the available hardware concurrency. + + Given 0 CPack will try to use all available CPU cores. + 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. + Currently only ``xz`` compression *may* take advantage of multiple cores. + Other compression methods ignore this value and use only one thread. .. versionadded:: 3.21 |