From 147d36ce93d563df4ce1899facbb256e6bc9bbb2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 28 Jan 2019 13:31:01 -0500 Subject: Find native build tool after selecting a toolset This will allow `CMAKE_GENERATOR_TOOLSET` to influence build tool selection. For reference, commit f8cb9944a1 (Find native build tool after determining the target system, 2017-09-26, v3.10.0-rc1~31^2) already delayed this step from where it was historically. --- Source/cmGlobalGenerator.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 04af013..ccf7c73 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -568,11 +568,6 @@ void cmGlobalGenerator::EnableLanguage( return; } - // Find the native build tool for this generator. - if (!this->FindMakeProgram(mf)) { - return; - } - // Tell the generator about the target system. std::string system = mf->GetSafeDefinition("CMAKE_SYSTEM_NAME"); if (!this->SetSystemName(system, mf)) { @@ -593,6 +588,11 @@ void cmGlobalGenerator::EnableLanguage( cmSystemTools::SetFatalErrorOccured(); return; } + + // Find the native build tool for this generator. + if (!this->FindMakeProgram(mf)) { + return; + } } // Check that the languages are supported by the generator and its -- cgit v0.12 From da402a081b6575b4813e5e8798105317b451ac1e Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 28 Jan 2019 13:33:32 -0500 Subject: VS: Use MSBuild matching toolset host architecture VS 2017 and VS 2019 provide `amd64/MSBuild.exe` variants next to their `MSBuild.exe` tools. When the 64-bit host toolchain is selected (e.g. via `host=x64`), select the 64-bit MSBuild too. Fixes: #18219 --- Source/cmGlobalVisualStudioVersionedGenerator.cxx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index bc6b453..12d9304 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -471,6 +471,18 @@ std::string cmGlobalVisualStudioVersionedGenerator::FindMSBuildCommand() // Ask Visual Studio Installer tool. std::string vs; if (vsSetupAPIHelper.GetVSInstanceInfo(vs)) { + std::string const& hostArch = + this->GetPlatformToolsetHostArchitectureString(); + if (hostArch == "x64") { + msbuild = vs + "/MSBuild/Current/Bin/amd64/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild)) { + return msbuild; + } + msbuild = vs + "/MSBuild/15.0/Bin/amd64/MSBuild.exe"; + if (cmSystemTools::FileExists(msbuild)) { + return msbuild; + } + } msbuild = vs + "/MSBuild/Current/Bin/MSBuild.exe"; if (cmSystemTools::FileExists(msbuild)) { return msbuild; -- cgit v0.12