From ed37fc3ea398b03bbba175ae337f14b6af58daee Mon Sep 17 00:00:00 2001 From: David Cole Date: Mon, 13 Sep 2010 13:29:10 -0400 Subject: [PATCH] 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. --- Source/cmVisualStudio10TargetGenerator.cxx | 73 +++++++++++++--------- 1 file changed, 45 insertions(+), 28 deletions(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index b37457966..b290aed73 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -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("\n", 2); this->WriteString("<_ProjectFileVersion>10.0.20506.1" "\n", 3); @@ -827,33 +829,48 @@ void cmVisualStudio10TargetGenerator::WritePathAndIncrementalLinkOptions() for(std::vector::iterator config = configs->begin(); config != configs->end(); ++config) { - std::string targetNameFull = - this->Target->GetFullName(config->c_str()); - std::string intermediateDir = this->LocalGenerator-> - GetTargetDirectory(*this->Target); - intermediateDir += "/"; - intermediateDir += *config; - intermediateDir += "/"; - 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 - << "\\" - << "\n"; - this->WritePlatformConfigTag("IntDir", config->c_str(), 3); - *this->BuildFileStream << intermediateDir - << "\n"; - this->WritePlatformConfigTag("TargetName", config->c_str(), 3); - *this->BuildFileStream - << cmSystemTools::GetFilenameWithoutLastExtension( - targetNameFull.c_str()) - << "\n"; - this->WritePlatformConfigTag("TargetExt", config->c_str(), 3); - *this->BuildFileStream << cmSystemTools::GetFilenameLastExtension( - targetNameFull.c_str()) - << "\n"; - this->OutputLinkIncremental(*config); + if(ttype >= cmTarget::UTILITY) + { + this->WritePlatformConfigTag("IntDir", config->c_str(), 3); + *this->BuildFileStream + << "$(Platform)\\$(Configuration)\\$(ProjectName)\\" + << "\n"; + } + else + { + std::string targetNameFull = + this->Target->GetFullName(config->c_str()); + std::string intermediateDir = this->LocalGenerator-> + GetTargetDirectory(*this->Target); + intermediateDir += "/"; + intermediateDir += *config; + intermediateDir += "/"; + 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 + << "\\" + << "\n"; + + this->WritePlatformConfigTag("IntDir", config->c_str(), 3); + *this->BuildFileStream << intermediateDir + << "\n"; + + this->WritePlatformConfigTag("TargetName", config->c_str(), 3); + *this->BuildFileStream + << cmSystemTools::GetFilenameWithoutLastExtension( + targetNameFull.c_str()) + << "\n"; + + this->WritePlatformConfigTag("TargetExt", config->c_str(), 3); + *this->BuildFileStream + << cmSystemTools::GetFilenameLastExtension(targetNameFull.c_str()) + << "\n"; + + this->OutputLinkIncremental(*config); + } } this->WriteString("\n", 2); }