cmake --build: Use both inter- and intra-project parallelism with msbuild

Since commit 1ab3881ec9 (cmake: Add options for parallel builds to
--build mode, 2018-04-14, v3.12.0-rc1~42^2), `cmake --build --parallel`
has added two options to the msbuild command line:

* `/m` enables inter-project parallelism in msbuild.
* `/p:CL_MPCount=1` suppresses intra-project parallelism in cl.

The latter was used to avoid `O(N^2)` compilation threads on `N`
processors.  In practice however, projects often have many source files
in a few targets, so `--parallel` actually reduces parallelism.

Drop the latter option to restore intra-project parallelism.
Users can always add `-- /p:CL_MPCount=1` themselves.

Fixes: #20564
This commit is contained in:
Brad King
2022-11-16 09:38:41 -05:00
parent d59f861e42
commit 48db261e69

View File

@@ -1155,8 +1155,6 @@ cmGlobalVisualStudio10Generator::GenerateBuildCommand(
} else {
makeCommand.Add(cmStrCat("/m:", std::to_string(jobs)));
}
// Having msbuild.exe and cl.exe using multiple jobs is discouraged
makeCommand.Add("/p:CL_MPCount=1");
}
// Respect the verbosity: 'n' normal will show build commands