diff options
author | Brad King <brad.king@kitware.com> | 2023-03-21 13:06:40 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2023-03-21 13:06:52 (GMT) |
commit | cb41fc469b4d351c95d25928b41219a961d54555 (patch) | |
tree | 5f7f418135e784464d1c928903cd02f6434abfe9 /Source | |
parent | 926501c42ae9d4c17a988412e570a1cf99eee5af (diff) | |
parent | a42ecb16149e76fcfb946d29e3ffc34077ba4bdf (diff) | |
download | CMake-cb41fc469b4d351c95d25928b41219a961d54555.zip CMake-cb41fc469b4d351c95d25928b41219a961d54555.tar.gz CMake-cb41fc469b4d351c95d25928b41219a961d54555.tar.bz2 |
Merge topic 'autogen-parallel-number'
a42ecb1614 Autogen: Restore AUTOGEN_PARALLEL support for numbers
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !8336
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmQtAutoGenInitializer.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmQtAutoGenInitializer.cxx b/Source/cmQtAutoGenInitializer.cxx index 410330a..667e0f5 100644 --- a/Source/cmQtAutoGenInitializer.cxx +++ b/Source/cmQtAutoGenInitializer.cxx @@ -5,6 +5,7 @@ #include <cstddef> #include <deque> #include <initializer_list> +#include <limits> #include <map> #include <set> #include <sstream> // for basic_ios, istringstream @@ -457,12 +458,23 @@ bool cmQtAutoGenInitializer::InitCustomTargets() // Autogen target parallel processing { + using ParallelType = decltype(this->AutogenTarget.Parallel); + unsigned long propInt = 0; std::string const& prop = this->GenTarget->GetSafeProperty("AUTOGEN_PARALLEL"); if (prop.empty() || (prop == "AUTO")) { // Autodetect number of CPUs this->AutogenTarget.Parallel = GetParallelCPUCount(); + } else if (cmStrToULong(prop, &propInt) && propInt > 0 && + propInt <= std::numeric_limits<ParallelType>::max()) { + this->AutogenTarget.Parallel = static_cast<ParallelType>(propInt); } else { + // Warn the project author that AUTOGEN_PARALLEL is not valid. + this->Makefile->IssueMessage( + MessageType::AUTHOR_WARNING, + cmStrCat("AUTOGEN_PARALLEL=\"", prop, "\" for target \"", + this->GenTarget->GetName(), + "\" is not valid. Using AUTOGEN_PARALLEL=1")); this->AutogenTarget.Parallel = 1; } } |