From f9aef0e422b7e308d48bb409c435cc78739c4804 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 27 Jul 2005 13:36:36 -0400 Subject: ENH: Generator now creates a separate intermediate files directory for each target. This is needed for MSVC 8 to support parallel builds. --- Source/cmGlobalVisualStudio7Generator.cxx | 4 ++-- Source/cmLocalVisualStudio7Generator.cxx | 34 ++++++++++++++++++++++++------- Source/cmLocalVisualStudio7Generator.h | 1 + 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 34ae9a2..c44a782 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -31,7 +31,7 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator() void cmGlobalVisualStudio7Generator::EnableLanguage(std::vectorconst & lang, cmMakefile *mf) { - mf->AddDefinition("CMAKE_CFG_INTDIR","$(IntDir)"); + mf->AddDefinition("CMAKE_CFG_INTDIR","$(OutDir)"); mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); @@ -200,7 +200,7 @@ void cmGlobalVisualStudio7Generator::Generate() gen[0]->GetMakefile()-> AddUtilityCommand("INSTALL", false, no_output, no_depends, cmake_command.c_str(), - "-DBUILD_TYPE=$(IntDir)", "-P", "cmake_install.cmake"); + "-DBUILD_TYPE=$(OutDir)", "-P", "cmake_install.cmake"); // Make the INSTALL target depend on ALL_BUILD unless the // project says to not do so. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index a583613..2b125df 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -421,8 +421,15 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, programDatabase += libpath; programDatabase += "\""; } - - fout << "\t\t\tIntermediateDirectory=\".\\" << configName << "\"\n" + + // The intermediate directory name consists of a directory for the + // target and a subdirectory for the configuration name. + std::string intermediateDir = this->GetTargetDirectory(target); + intermediateDir += "/"; + intermediateDir += configName; + fout << "\t\t\tIntermediateDirectory=\"" + << this->ConvertToXMLOutputPath(intermediateDir.c_str()) + << "\"\n" << "\t\t\tConfigurationType=\"" << configType << "\"\n" << "\t\t\tUseOfMFC=\"" << mfcFlag << "\"\n" << "\t\t\tATLMinimizesCRunTimeLibraryUsage=\"FALSE\"\n"; @@ -505,7 +512,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, this->OutputDefineFlags(defineFlags.c_str(), fout); fout << "\"\n"; fout << "\t\t\t\tAssemblerListingLocation=\"" << configName << "\"\n"; - fout << "\t\t\t\tObjectFile=\"" << configName << "\\\"\n"; + fout << "\t\t\t\tObjectFile=\"$(IntDir)\\\"\n"; if(m_Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")) { fout << "\t\t\t\tSuppressStartupBanner=\"FALSE\"\n"; @@ -822,7 +829,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(std::ostream& fout, { hasone = true; std::string temp = m_LibraryOutputPath; - temp += "$(INTDIR)"; + temp += "$(OutDir)"; fout << this->ConvertToXMLOutputPath(temp.c_str()) << "," << this->ConvertToXMLOutputPath(m_LibraryOutputPath.c_str()); @@ -836,7 +843,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(std::ostream& fout, } hasone = true; std::string temp = m_ExecutableOutputPath; - temp += "$(INTDIR)"; + temp += "$(OutDir)"; fout << this->ConvertToXMLOutputPath(temp.c_str()) << "," << this->ConvertToXMLOutputPath(m_ExecutableOutputPath.c_str()); } @@ -857,7 +864,7 @@ void cmLocalVisualStudio7Generator::OutputLibraryDirectories(std::ostream& fout, { fout << ","; } - std::string lpathi = lpath + "$(INTDIR)"; + std::string lpathi = lpath + "$(OutDir)"; fout << this->ConvertToXMLOutputPath(lpathi.c_str()) << "," << this->ConvertToXMLOutputPath(lpath.c_str()); hasone = true; @@ -1204,7 +1211,7 @@ WriteCustomRule(std::ostream& fout, libPath = cacheValue; } libPath += "/"; - libPath += "$(INTDIR)/"; + libPath += "$(OutDir)/"; libPath += dep; libPath += ".exe"; fout << this->ConvertToXMLOutputPath(libPath.c_str()) @@ -1418,3 +1425,16 @@ void cmLocalVisualStudio7Generator::ConfigureFinalPass() } +//---------------------------------------------------------------------------- +std::string cmLocalVisualStudio7Generator::GetTargetDirectory(cmTarget& target) +{ + std::string dir; + // Put a prefix on the name if one is given by the CMake code. + if(const char* prefix = m_Makefile->GetDefinition("CMAKE_TARGET_DIR_PREFIX")) + { + dir += prefix; + } + dir += target.GetName(); + dir += ".dir"; + return dir; +} diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index af35274..1e20619 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -112,6 +112,7 @@ private: const char* extraFlags); void WriteGroup(const cmSourceGroup *sg, cmTarget target, std::ostream &fout, const char *libName, std::vector *configs); + virtual std::string GetTargetDirectory(cmTarget&); std::vector m_CreatedProjectNames; std::string m_LibraryOutputPath; -- cgit v0.12