VS2010: Set IntDir for utility and global targets.

VS2010 uses IntDir as the location for writing log files for
what happens during custom build steps. With no IntDir settings,
all ExternalProject usage within the same CMakeLists.txt file
would result in multiple utility targets all trying to use the
same custom build log files.

With parallel builds, they would try to use them simultaneously
and result in file access errors, preventing the builds from
completing successfully.

Now each utility target has its own IntDir setting, and so, its
own custom build rule log files.
This commit is contained in:
David Cole 2010-09-13 13:29:10 -04:00
parent e79e412e70
commit ed37fc3ea3
1 changed files with 45 additions and 28 deletions

View File

@ -814,10 +814,12 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
{
if(this->Target->GetType() > cmTarget::MODULE_LIBRARY)
cmTarget::TargetType ttype = this->Target->GetType();
if(ttype > cmTarget::GLOBAL_TARGET)
{
return;
}
this->WriteString("<PropertyGroup>\n", 2);
this->WriteString("<_ProjectFileVersion>10.0.20506.1"
"</_ProjectFileVersion>\n", 3);
@ -827,6 +829,15 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
for(std::vector<std::string>::iterator config = configs->begin();
config != configs->end(); ++config)
{
if(ttype >= cmTarget::UTILITY)
{
this->WritePlatformConfigTag("IntDir", config->c_str(), 3);
*this->BuildFileStream
<< "$(Platform)\\$(Configuration)\\$(ProjectName)\\"
<< "</IntDir>\n";
}
else
{
std::string targetNameFull =
this->Target->GetFullName(config->c_str());
std::string intermediateDir = this->LocalGenerator->
@ -837,24 +848,30 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions()
this->ConvertToWindowsSlash(intermediateDir);
std::string outDir = this->Target->GetDirectory(config->c_str());
this->ConvertToWindowsSlash(outDir);
this->WritePlatformConfigTag("OutDir", config->c_str(), 3);
*this->BuildFileStream << outDir
<< "\\"
<< "</OutDir>\n";
this->WritePlatformConfigTag("IntDir", config->c_str(), 3);
*this->BuildFileStream << intermediateDir
<< "</IntDir>\n";
this->WritePlatformConfigTag("TargetName", config->c_str(), 3);
*this->BuildFileStream
<< cmSystemTools::GetFilenameWithoutLastExtension(
targetNameFull.c_str())
<< "</TargetName>\n";
this->WritePlatformConfigTag("TargetExt", config->c_str(), 3);
*this->BuildFileStream << cmSystemTools::GetFilenameLastExtension(
targetNameFull.c_str())
*this->BuildFileStream
<< cmSystemTools::GetFilenameLastExtension(targetNameFull.c_str())
<< "</TargetExt>\n";
this->OutputLinkIncremental(*config);
}
}
this->WriteString("</PropertyGroup>\n", 2);
}