Avoid msbuild ".\" idiosyncrasy that builds multiple configs (#11594)
If a .sln file refers to a project file with a leading ".\", as in
".\foo.vcxproj" instead of just "foo.vcxproj" or a full path then
msbuild behaves strangely. Whenever target foo is built as a dependency
of another target, msbuild brings multiple configurations up to date
instead of just the requested configuration!
Avoid a leading ".\" in project file references to avoid this behavior.
This alternative fix to that attempted by commit 57e71533
(Avoid msbuild
idiosyncrasy that builds multiple configs, 2010-12-10) avoids use of
full path project file references which vcbuild does not support.
This commit is contained in:
parent
42a2e9d91a
commit
e1442ac9c1
|
@ -182,8 +182,8 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
|
|||
std::string guid = this->GetGUID(dspname);
|
||||
fout << project
|
||||
<< dspname << "\", \""
|
||||
<< this->ConvertToSolutionPath(dir)
|
||||
<< "\\" << dspname << ext << "\", \"{" << guid << "}\"\n";
|
||||
<< this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"")
|
||||
<< dspname << ext << "\", \"{" << guid << "}\"\n";
|
||||
fout << "\tProjectSection(ProjectDependencies) = postProject\n";
|
||||
this->WriteProjectDepends(fout, dspname, dir, t);
|
||||
fout << "\tEndProjectSection\n";
|
||||
|
@ -196,8 +196,8 @@ cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
|
|||
const char* uname = ui->second.c_str();
|
||||
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
|
||||
<< uname << "\", \""
|
||||
<< this->ConvertToSolutionPath(dir)
|
||||
<< "\\" << uname << ".vcproj" << "\", \"{"
|
||||
<< this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"")
|
||||
<< uname << ".vcproj" << "\", \"{"
|
||||
<< this->GetGUID(uname) << "}\"\n"
|
||||
<< "\tProjectSection(ProjectDependencies) = postProject\n"
|
||||
<< "\t\t{" << guid << "} = {" << guid << "}\n"
|
||||
|
|
|
@ -299,6 +299,10 @@ void cmGlobalVisualStudio7Generator::WriteTargetsToSolution(
|
|||
std::string dir = tmf->GetStartOutputDirectory();
|
||||
dir = root->Convert(dir.c_str(),
|
||||
cmLocalGenerator::START_OUTPUT);
|
||||
if(dir == ".")
|
||||
{
|
||||
dir = ""; // msbuild cannot handle ".\" prefix
|
||||
}
|
||||
this->WriteProject(fout, vcprojName, dir.c_str(),
|
||||
*target);
|
||||
written = true;
|
||||
|
@ -514,8 +518,8 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
|
|||
|
||||
fout << project
|
||||
<< dspname << "\", \""
|
||||
<< this->ConvertToSolutionPath(dir)
|
||||
<< "\\" << dspname << ext << "\", \"{"
|
||||
<< this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"")
|
||||
<< dspname << ext << "\", \"{"
|
||||
<< this->GetGUID(dspname) << "}\"\nEndProject\n";
|
||||
|
||||
UtilityDependsMap::iterator ui = this->UtilityDepends.find(&target);
|
||||
|
@ -524,8 +528,8 @@ void cmGlobalVisualStudio7Generator::WriteProject(std::ostream& fout,
|
|||
const char* uname = ui->second.c_str();
|
||||
fout << "Project(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \""
|
||||
<< uname << "\", \""
|
||||
<< this->ConvertToSolutionPath(dir)
|
||||
<< "\\" << uname << ".vcproj" << "\", \"{"
|
||||
<< this->ConvertToSolutionPath(dir) << (dir[0]? "\\":"")
|
||||
<< uname << ".vcproj" << "\", \"{"
|
||||
<< this->GetGUID(uname) << "}\"\n"
|
||||
<< "EndProject\n";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue