1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-16 05:26:58 +08:00

Ninja: Fix regression with .bat wrapper around ninja

Revise the change from commit 5a36d0c9e7 (Ninja: Fix regression with a
large number of subdirectories, 2025-03-04, v4.0.0-rc3~2^2) to use a
command-line length limit small enough for `.bat` files.

Fixes: #27153
This commit is contained in:
Brad King
2025-08-25 11:31:23 -04:00
parent d0b490aaf0
commit 6de40e7a4d

View File

@@ -705,8 +705,9 @@ void cmGlobalNinjaGenerator::CleanMetaData()
auto output_it = outputs.begin();
size_t static_arg_size = ninja_tool_arg_size + this->NinjaCommand.size() +
this->GetCMakeInstance()->GetHomeOutputDirectory().size();
// The Windows command-line length limit is 32768. Leave plenty.
constexpr size_t maximum_arg_size = 30000;
// The Windows command-line length limit is 32768, but if `ninja` is
// wrapped by a `.bat` file, the limit is 8192. Leave plenty.
constexpr size_t maximum_arg_size = 8000;
while (output_it != outputs.end()) {
size_t total_arg_size = static_arg_size;
std::vector<char const*> args;