Skip to content

Commit

Permalink
fix CMake max_cpu_count (#17292)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded authored Nov 8, 2024
1 parent c74f05f commit 7728bc9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion conan/tools/cmake/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def _cmake_cmd_line_args(conanfile, generator):

maxcpucount = conanfile.conf.get("tools.microsoft.msbuild:max_cpu_count", check_type=int)
if maxcpucount and "Visual Studio" in generator:
args.append("/m:{}".format(njobs))
args.append("/m:{}".format(maxcpucount))

# Arguments for verbosity
if "Visual Studio" in generator:
Expand Down
3 changes: 2 additions & 1 deletion test/unittests/tools/cmake/test_cmake_cmd_line_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def conanfile():
c = ConfDefinition()
c.loads(textwrap.dedent("""\
tools.build:jobs=10
tools.microsoft.msbuild:max_cpu_count=23
"""))

conanfile = ConanFileMock()
Expand Down Expand Up @@ -39,7 +40,7 @@ def test_ninja(conanfile):

def test_visual_studio(conanfile):
args = _cmake_cmd_line_args(conanfile, 'Visual Studio 16 2019')
assert [] == args
assert ["/m:23"] == args

args = _cmake_cmd_line_args(conanfile, 'Ninja')
assert args == ['-j10']

0 comments on commit 7728bc9

Please sign in to comment.