diff --git a/tools/setup_helpers/cmake.py b/tools/setup_helpers/cmake.py index dd8f817aba2c2..ed0df72e89847 100644 --- a/tools/setup_helpers/cmake.py +++ b/tools/setup_helpers/cmake.py @@ -387,7 +387,7 @@ def build(self, my_env: Dict[str, str]) -> None: # then. Until then, we use "--" to pass parameters to the # underlying build system. build_args += ['--'] - if IS_WINDOWS: + if IS_WINDOWS and not USE_NINJA: # We are likely using msbuild here build_args += ['/p:CL_MPCount={}'.format(max_jobs)] else: diff --git a/tools/test/test_cmake.py b/tools/test/test_cmake.py index a9fae6dc90e02..ecbce07f52d23 100644 --- a/tools/test/test_cmake.py +++ b/tools/test/test_cmake.py @@ -22,7 +22,11 @@ def test_build_jobs(self, mock_cpu_count: unittest.mock.MagicMock) -> None: # MAX_JOBS, USE_NINJA, IS_WINDOWS, want (( '8', True, False), ['-j', '8']), # noqa: E201,E241 (( None, True, False), None), # noqa: E201,E241 + (( '7', False, False), ['-j', '7']), # noqa: E201,E241 + (( None, False, False), ['-j', '13']), # noqa: E201,E241 + (( '6', True, True), ['-j', '6']), # noqa: E201,E241 (( None, True, True), None), # noqa: E201,E241 + (( '11', False, True), ['/p:CL_MPCount=11']), # noqa: E201,E241 (( None, False, True), ['/p:CL_MPCount=13']), # noqa: E201,E241 ] for (max_jobs, use_ninja, is_windows), want in cases: