فهرست منبع

cmLocalGenerator: Add Home directory accessors.

Reduce reasons for cmLocalGenerator to have a cmMakefile.
Stephen Kelly 10 سال پیش
والد
کامیت
12cb3bdce4

+ 3 - 2
Source/cmComputeLinkInformation.cxx

@@ -1975,8 +1975,9 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
       else if(use_link_rpath)
         {
         // Do not add any path inside the source or build tree.
-        const char* topSourceDir = this->Makefile->GetHomeDirectory();
-        const char* topBinaryDir = this->Makefile->GetHomeOutputDirectory();
+        const char* topSourceDir = this->CMakeInstance->GetHomeDirectory();
+        const char* topBinaryDir =
+            this->CMakeInstance->GetHomeOutputDirectory();
         if(!cmSystemTools::ComparePath(*ri, topSourceDir) &&
            !cmSystemTools::ComparePath(*ri, topBinaryDir) &&
            !cmSystemTools::IsSubDirectory(*ri, topSourceDir) &&

+ 4 - 2
Source/cmExportFileGenerator.cxx

@@ -245,8 +245,10 @@ static bool checkInterfaceDirs(const std::string &prepro,
 {
   const char* installDir =
             target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
-  const char* topSourceDir = target->Makefile->GetHomeDirectory();
-  const char* topBinaryDir = target->Makefile->GetHomeOutputDirectory();
+  const char* topSourceDir =
+      target->GetLocalGenerator()->GetSourceDirectory();
+  const char* topBinaryDir =
+      target->GetLocalGenerator()->GetBinaryDirectory();
 
   std::vector<std::string> parts;
   cmGeneratorExpression::Split(prepro, parts);

+ 3 - 3
Source/cmExtraCodeBlocksGenerator.cxx

@@ -273,7 +273,7 @@ void cmExtraCodeBlocksGenerator
         }
 
       const std::string &relative = cmSystemTools::RelativePath(
-                         it->second[0]->GetMakefile()->GetHomeDirectory(),
+                         it->second[0]->GetSourceDirectory(),
                          jt->c_str());
       std::vector<std::string> splitted;
       cmSystemTools::SplitPath(relative, splitted, false);
@@ -297,7 +297,7 @@ void cmExtraCodeBlocksGenerator
   tree.BuildVirtualFolder(virtualFolders);
   // And one for <Unit>
   std::string unitFiles;
-  tree.BuildUnit(unitFiles, std::string(mf->GetHomeDirectory()) + "/");
+  tree.BuildUnit(unitFiles, std::string(lgs[0]->GetSourceDirectory()) + "/");
 
   // figure out the compiler
   std::string compiler = this->GetCBCompilerId(mf);
@@ -332,7 +332,7 @@ void cmExtraCodeBlocksGenerator
           // Only add the global targets from CMAKE_BINARY_DIR,
           // not from the subdirs
           if (strcmp(makefile->GetCurrentBinaryDirectory(),
-                     makefile->GetHomeOutputDirectory())==0)
+                     (*lg)->GetBinaryDirectory())==0)
             {
             this->AppendTarget(fout, ti->first, 0,
                                make.c_str(), *lg, compiler.c_str());

+ 2 - 2
Source/cmExtraCodeLiteGenerator.cxx

@@ -69,11 +69,11 @@ void cmExtraCodeLiteGenerator::Generate()
     this->ConfigName = GetConfigurationName( mf );
 
     if (strcmp(mf->GetCurrentBinaryDirectory(),
-               mf->GetHomeOutputDirectory()) == 0)
+               it->second[0]->GetBinaryDirectory()) == 0)
       {
       workspaceOutputDir   = mf->GetCurrentBinaryDirectory();
       workspaceProjectName = it->second[0]->GetProjectName();
-      workspaceSourcePath  = mf->GetHomeDirectory();
+      workspaceSourcePath  = it->second[0]->GetSourceDirectory();
       workspaceFileName    = workspaceOutputDir+"/";
       workspaceFileName   += workspaceProjectName + ".workspace";
       this->WorkspacePath = mf->GetCurrentBinaryDirectory();;

+ 7 - 7
Source/cmExtraEclipseCDT4Generator.cxx

@@ -79,8 +79,8 @@ void cmExtraEclipseCDT4Generator
 //----------------------------------------------------------------------------
 void cmExtraEclipseCDT4Generator::Generate()
 {
-  const cmMakefile* mf
-    = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
+  cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
+  const cmMakefile* mf = lg->GetMakefile();
 
   std::string eclipseVersion = mf->GetSafeDefinition("CMAKE_ECLIPSE_VERSION");
   cmsys::RegularExpression regex(".*([0-9]+\\.[0-9]+).*");
@@ -106,8 +106,8 @@ void cmExtraEclipseCDT4Generator::Generate()
     }
 
   // TODO: Decide if these are local or member variables
-  this->HomeDirectory       = mf->GetHomeDirectory();
-  this->HomeOutputDirectory = mf->GetHomeOutputDirectory();
+  this->HomeDirectory       = lg->GetSourceDirectory();
+  this->HomeOutputDirectory = lg->GetBinaryDirectory();
 
   this->GenerateLinkedResources = mf->IsOn(
                                     "CMAKE_ECLIPSE_GENERATE_LINKED_RESOURCES");
@@ -226,7 +226,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
     mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
                            cacheEntryName.c_str(), cmState::STRING,
                            true);
-    mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
+    mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
     }
   else if (envVarValue==0 && cacheValue!=0)
     {
@@ -247,7 +247,7 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
       mf->AddCacheDefinition(cacheEntryName, valueToUse.c_str(),
                              cacheEntryName.c_str(), cmState::STRING,
                              true);
-      mf->GetCMakeInstance()->SaveCache(mf->GetHomeOutputDirectory());
+      mf->GetCMakeInstance()->SaveCache(lg->GetBinaryDirectory());
       }
     }
 
@@ -1091,7 +1091,7 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
           virtDir += prefix;
           virtDir += ti->first;
           std::string buildArgs = "-C \"";
-          buildArgs += makefile->GetHomeOutputDirectory();
+          buildArgs += (*it)->GetBinaryDirectory();
           buildArgs += "\" ";
           buildArgs += makeArgs;
           this->AppendTarget(fout, "Build", make, buildArgs, virtDir, "",

+ 13 - 16
Source/cmExtraKateGenerator.cxx

@@ -50,7 +50,7 @@ void cmExtraKateGenerator::Generate()
   const cmMakefile* mf = lg->GetMakefile();
   this->ProjectName = this->GenerateProjectName(lg->GetProjectName(),
                           mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
-                          this->GetPathBasename(mf->GetHomeOutputDirectory()));
+                          this->GetPathBasename(lg->GetBinaryDirectory()));
   this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja");
 
   this->CreateKateProjectFile(lg);
@@ -61,8 +61,7 @@ void cmExtraKateGenerator::Generate()
 void cmExtraKateGenerator::CreateKateProjectFile(
     const cmLocalGenerator* lg) const
 {
-  const cmMakefile* mf = lg->GetMakefile();
-  std::string filename = mf->GetHomeOutputDirectory();
+  std::string filename = lg->GetBinaryDirectory();
   filename += "/.kateproject";
   cmGeneratedFileStream fout(filename.c_str());
   if (!fout)
@@ -73,9 +72,9 @@ void cmExtraKateGenerator::CreateKateProjectFile(
   fout <<
     "{\n"
     "\t\"name\": \"" << this->ProjectName << "\",\n"
-    "\t\"directory\": \"" << mf->GetHomeDirectory() << "\",\n"
-    "\t\"files\": [ { " << this->GenerateFilesString(mf) << "} ],\n";
-  this->WriteTargets(mf, fout);
+    "\t\"directory\": \"" << lg->GetSourceDirectory() << "\",\n"
+    "\t\"files\": [ { " << this->GenerateFilesString(lg) << "} ],\n";
+  this->WriteTargets(lg, fout);
   fout << "}\n";
 }
 
@@ -84,15 +83,15 @@ void
 cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
                                    cmGeneratedFileStream& fout) const
 {
-  cmMakefile* mf = lg->GetMakefile();
+  cmMakefile const* mf = lg->GetMakefile();
   const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
   const std::string makeArgs = mf->GetSafeDefinition(
     "CMAKE_KATE_MAKE_ARGUMENTS");
-  const char* homeOutputDir = mf->GetHomeOutputDirectory();
+  const char* homeOutputDir = lg->GetBinaryDirectory();
 
   fout <<
   "\t\"build\": {\n"
-  "\t\t\"directory\": \"" << mf->GetHomeOutputDirectory() << "\",\n"
+  "\t\t\"directory\": \"" << lg->GetBinaryDirectory() << "\",\n"
   "\t\t\"default_target\": \"all\",\n"
   "\t\t\"clean_target\": \"clean\",\n";
 
@@ -123,7 +122,7 @@ cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
     const cmTargets& targets = (*it)->GetMakefile()->GetTargets();
     cmMakefile* makefile=(*it)->GetMakefile();
     std::string currentDir = makefile->GetCurrentBinaryDirectory();
-    bool topLevel = (currentDir == makefile->GetHomeOutputDirectory());
+    bool topLevel = (currentDir == (*it)->GetBinaryDirectory());
 
     for(cmTargets::const_iterator ti=targets.begin(); ti!=targets.end(); ++ti)
       {
@@ -237,8 +236,7 @@ void
 cmExtraKateGenerator::CreateDummyKateProjectFile(
     const cmLocalGenerator* lg) const
 {
-  cmMakefile* mf = lg->GetMakefile();
-  std::string filename = mf->GetHomeOutputDirectory();
+  std::string filename = lg->GetBinaryDirectory();
   filename += "/";
   filename += this->ProjectName;
   filename += ".kateproject";
@@ -256,22 +254,21 @@ cmExtraKateGenerator::CreateDummyKateProjectFile(
 std::string
 cmExtraKateGenerator::GenerateFilesString(const cmLocalGenerator* lg) const
 {
-  cmMakefile* mf = lg->GetMakefile();
-  std::string s = mf->GetHomeDirectory();
+  std::string s = lg->GetSourceDirectory();
   s += "/.git";
   if(cmSystemTools::FileExists(s.c_str()))
   {
     return std::string("\"git\": 1 ");
   }
 
-  s = mf->GetHomeDirectory();
+  s = lg->GetSourceDirectory();
   s += "/.svn";
   if(cmSystemTools::FileExists(s.c_str()))
   {
     return std::string("\"svn\": 1 ");
   }
 
-  s = mf->GetHomeDirectory();
+  s = lg->GetSourceDirectory();
   s += "/";
 
   std::set<std::string> files;

+ 6 - 6
Source/cmExtraSublimeTextGenerator.cxx

@@ -99,8 +99,8 @@ void cmExtraSublimeTextGenerator
     }
 
   const std::string &sourceRootRelativeToOutput = cmSystemTools::RelativePath(
-                     mf->GetHomeOutputDirectory(),
-                     mf->GetHomeDirectory());
+                     lgs[0]->GetBinaryDirectory(),
+                     lgs[0]->GetSourceDirectory());
   // Write the folder entries to the project file
   fout << "{\n";
   fout << "\t\"folders\":\n\t[\n\t";
@@ -108,8 +108,8 @@ void cmExtraSublimeTextGenerator
     {
       fout << "\t{\n\t\t\t\"path\": \"" << sourceRootRelativeToOutput << "\"";
       const std::string &outputRelativeToSourceRoot =
-        cmSystemTools::RelativePath(mf->GetHomeDirectory(),
-                                    mf->GetHomeOutputDirectory());
+        cmSystemTools::RelativePath(lgs[0]->GetSourceDirectory(),
+                                    lgs[0]->GetBinaryDirectory());
       if ((!outputRelativeToSourceRoot.empty()) &&
         ((outputRelativeToSourceRoot.length() < 3) ||
           (outputRelativeToSourceRoot.substr(0, 3) != "../")))
@@ -173,8 +173,8 @@ void cmExtraSublimeTextGenerator::
           {
           // Only add the global targets from CMAKE_BINARY_DIR,
           // not from the subdirs
-          if (strcmp(makefile->GetCurrentBinaryDirectory(),
-                     makefile->GetHomeOutputDirectory())==0)
+          if (strcmp((*lg)->GetCurrentBinaryDirectory(),
+                     (*lg)->GetBinaryDirectory())==0)
             {
             this->AppendTarget(fout, ti->first, *lg, 0,
                                make.c_str(), makefile, compiler.c_str(),

+ 4 - 2
Source/cmGhsMultiTargetGenerator.cxx

@@ -68,7 +68,9 @@ cmGhsMultiTargetGenerator::GetRelBuildFilePath(const cmTarget *target)
 std::string
 cmGhsMultiTargetGenerator::GetAbsPathToRoot(const cmTarget *target)
 {
-  return target->GetMakefile()->GetHomeOutputDirectory();
+  cmGeneratorTarget* gt = target->GetMakefile()->GetGlobalGenerator()
+      ->GetGeneratorTarget(target);
+  return gt->GetLocalGenerator()->GetBinaryDirectory();
 }
 
 std::string
@@ -450,7 +452,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
     cmSystemTools::ConvertToUnixSlashes(sgPath);
     cmGlobalGhsMultiGenerator::AddFilesUpToPath(
       this->GetFolderBuildStreams(), &this->FolderBuildStreams,
-      this->Makefile->GetHomeOutputDirectory(), sgPath,
+      this->LocalGenerator->GetBinaryDirectory(), sgPath,
       GhsMultiGpj::SUBPROJECT, this->RelBuildFilePath);
 
     std::string fullSourcePath((*si)->GetFullPath());

+ 2 - 4
Source/cmGlobalGenerator.cxx

@@ -399,7 +399,7 @@ cmGlobalGenerator::EnableLanguage(std::vector<std::string>const& languages,
   bool fatalError = false;
 
   mf->AddDefinition("RUN_CONFIGURE", true);
-  std::string rootBin = mf->GetHomeOutputDirectory();
+  std::string rootBin = this->CMakeInstance->GetHomeOutputDirectory();
   rootBin += cmake::GetCMakeFilesDirectory();
 
   // If the configuration files path has been set,
@@ -2879,10 +2879,8 @@ void cmGlobalGenerator::WriteRuleHashes(std::string const& pfile)
 //----------------------------------------------------------------------------
 void cmGlobalGenerator::WriteSummary()
 {
-  cmMakefile* mf = this->LocalGenerators[0]->GetMakefile();
-
   // Record all target directories in a central location.
-  std::string fname = mf->GetHomeOutputDirectory();
+  std::string fname = this->CMakeInstance->GetHomeOutputDirectory();
   fname += cmake::GetCMakeFilesDirectory();
   fname += "/TargetDirectories.txt";
   cmGeneratedFileStream fout(fname.c_str());

+ 1 - 1
Source/cmGlobalKdevelopGenerator.cxx

@@ -51,7 +51,7 @@ void cmGlobalKdevelopGenerator::Generate()
     {
     cmMakefile* mf = it->second[0]->GetMakefile();
     std::string outputDir=mf->GetCurrentBinaryDirectory();
-    std::string projectDir=mf->GetHomeDirectory();
+    std::string projectDir=it->second[0]->GetSourceDirectory();
     std::string projectName=it->second[0]->GetProjectName();
     std::string cmakeFilePattern("CMakeLists.txt;*.cmake;");
     std::string fileToOpen;

+ 2 - 3
Source/cmGlobalNinjaGenerator.cxx

@@ -1198,16 +1198,15 @@ void cmGlobalNinjaGenerator::WriteTargetAll(std::ostream& os)
 void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os)
 {
   cmLocalGenerator *lg = this->LocalGenerators[0];
-  cmMakefile* mfRoot = lg->GetMakefile();
 
   std::ostringstream cmd;
   cmd << lg->ConvertToOutputFormat(cmSystemTools::GetCMakeCommand(),
                                    cmLocalGenerator::SHELL)
       << " -H"
-      << lg->ConvertToOutputFormat(mfRoot->GetHomeDirectory(),
+      << lg->ConvertToOutputFormat(lg->GetSourceDirectory(),
                                    cmLocalGenerator::SHELL)
       << " -B"
-      << lg->ConvertToOutputFormat(mfRoot->GetHomeOutputDirectory(),
+      << lg->ConvertToOutputFormat(lg->GetBinaryDirectory(),
                                    cmLocalGenerator::SHELL);
   WriteRule(*this->RulesFileStream,
             "RERUN_CMAKE",

+ 1 - 1
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -784,7 +784,7 @@ cmGlobalUnixMakefileGenerator3
       depends.clear();
 
       cmLocalUnixMakefileGenerator3::EchoProgress progress;
-      progress.Dir = lg->GetMakefile()->GetHomeOutputDirectory();
+      progress.Dir = lg->GetBinaryDirectory();
       progress.Dir += cmake::GetCMakeFilesDirectory();
       {
       std::ostringstream progressArg;

+ 2 - 2
Source/cmGlobalVisualStudio8Generator.cxx

@@ -312,10 +312,10 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
   cmCustomCommandLine commandLine;
   commandLine.push_back(cmSystemTools::GetCMakeCommand());
   std::string argH = "-H";
-  argH += mf->GetHomeDirectory();
+  argH += lg->GetSourceDirectory();
   commandLine.push_back(argH);
   std::string argB = "-B";
-  argB += mf->GetHomeOutputDirectory();
+  argB += lg->GetBinaryDirectory();
   commandLine.push_back(argB);
   commandLine.push_back("--check-stamp-list");
   commandLine.push_back(stampList.c_str());

+ 4 - 4
Source/cmGlobalXCodeGenerator.cxx

@@ -590,7 +590,7 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
     (this->CurrentReRunCMakeMakefile.c_str());
   makefileStream.SetCopyIfDifferent(true);
   makefileStream << "# Generated by CMake, DO NOT EDIT\n";
-  std::string checkCache = mf->GetHomeOutputDirectory();
+  std::string checkCache = root->GetBinaryDirectory();
   checkCache += "/";
   checkCache += cmake::GetCMakeFilesDirectoryPostSlash();
   checkCache += "cmake.check_cache";
@@ -604,9 +604,9 @@ void cmGlobalXCodeGenerator::CreateReRunCMakeFile(
   makefileStream << "\n\t" <<
     this->ConvertToRelativeForMake(cmSystemTools::GetCMakeCommand().c_str())
                  << " -H" << this->ConvertToRelativeForMake(
-                   mf->GetHomeDirectory())
+                   root->GetSourceDirectory())
                  << " -B" << this->ConvertToRelativeForMake(
-                   mf->GetHomeOutputDirectory()) << "\n";
+                   root->GetBinaryDirectory()) << "\n";
 }
 
 //----------------------------------------------------------------------------
@@ -3749,7 +3749,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
   // Since this call may have created new cache entries, save the cache:
   //
   root->GetMakefile()->GetCMakeInstance()->SaveCache(
-    root->GetMakefile()->GetHomeOutputDirectory());
+    root->GetBinaryDirectory());
 }
 
 //----------------------------------------------------------------------------

+ 10 - 0
Source/cmLocalGenerator.cxx

@@ -2868,6 +2868,16 @@ cmake* cmLocalGenerator::GetCMakeInstance() const
   return this->GlobalGenerator->GetCMakeInstance();
 }
 
+const char* cmLocalGenerator::GetSourceDirectory() const
+{
+  return this->GetCMakeInstance()->GetHomeDirectory();
+}
+
+const char* cmLocalGenerator::GetBinaryDirectory() const
+{
+  return this->GetCMakeInstance()->GetHomeOutputDirectory();
+}
+
 //----------------------------------------------------------------------------
 std::string
 cmLocalGenerator::GetTargetDirectory(cmTarget const&) const

+ 3 - 0
Source/cmLocalGenerator.h

@@ -255,6 +255,9 @@ public:
 
   cmake* GetCMakeInstance() const;
 
+  const char* GetSourceDirectory() const;
+  const char* GetBinaryDirectory() const;
+
   /**
    * Generate a Mac OS X application bundle Info.plist file.
    */

+ 12 - 12
Source/cmLocalUnixMakefileGenerator3.cxx

@@ -399,7 +399,7 @@ cmLocalUnixMakefileGenerator3
       );
     }
   this->CreateCDCommand(commands,
-                        this->Makefile->GetHomeOutputDirectory(),
+                        this->GetBinaryDirectory(),
                         cmLocalGenerator::START_OUTPUT);
 
   // Write the rule to the makefile.
@@ -449,7 +449,7 @@ void cmLocalUnixMakefileGenerator3
       commands.push_back(this->GetRecursiveMakeCall
                          (makefile2.c_str(),localName));
       this->CreateCDCommand(commands,
-                            this->Makefile->GetHomeOutputDirectory(),
+                            this->GetBinaryDirectory(),
                             cmLocalGenerator::START_OUTPUT);
       this->WriteMakeRule(ruleFileStream, "Convenience name for target.",
                           localName, depends, commands, true);
@@ -478,7 +478,7 @@ void cmLocalUnixMakefileGenerator3
       commands.push_back(this->GetRecursiveMakeCall
                          (makefileName.c_str(), makeTargetName));
       this->CreateCDCommand(commands,
-                            this->Makefile->GetHomeOutputDirectory(),
+                            this->GetBinaryDirectory(),
                             cmLocalGenerator::START_OUTPUT);
       this->WriteMakeRule(ruleFileStream, "fast build rule for target.",
                           localName, depends, commands, true);
@@ -496,7 +496,7 @@ void cmLocalUnixMakefileGenerator3
         commands.push_back(this->GetRecursiveMakeCall
                            (makefile2.c_str(), makeTargetName));
         this->CreateCDCommand(commands,
-                              this->Makefile->GetHomeOutputDirectory(),
+                              this->GetBinaryDirectory(),
                               cmLocalGenerator::START_OUTPUT);
         this->WriteMakeRule(ruleFileStream,
                             "Manual pre-install relink rule for target.",
@@ -750,13 +750,13 @@ cmLocalUnixMakefileGenerator3
   makefileStream
     << "# The top-level source directory on which CMake was run.\n"
     << "CMAKE_SOURCE_DIR = "
-    << this->Convert(this->Makefile->GetHomeDirectory(), FULL, SHELL)
+    << this->Convert(this->GetSourceDirectory(), FULL, SHELL)
     << "\n"
     << "\n";
   makefileStream
     << "# The top-level build directory on which CMake was run.\n"
     << "CMAKE_BINARY_DIR = "
-    << this->Convert(this->Makefile->GetHomeOutputDirectory(), FULL, SHELL)
+    << this->Convert(this->GetBinaryDirectory(), FULL, SHELL)
     << "\n"
     << "\n";
 }
@@ -889,7 +889,7 @@ void cmLocalUnixMakefileGenerator3
   if(!this->GetMakefile()->IsRootMakefile())
     {
     this->CreateCDCommand(commands,
-                          this->Makefile->GetHomeOutputDirectory(),
+                          this->GetBinaryDirectory(),
                           cmLocalGenerator::START_OUTPUT);
     }
   this->WriteMakeRule(makefileStream,
@@ -1838,7 +1838,7 @@ void cmLocalUnixMakefileGenerator3
 
   depends.push_back("cmake_check_build_system");
 
-  std::string progressDir = this->Makefile->GetHomeOutputDirectory();
+  std::string progressDir = this->GetBinaryDirectory();
   progressDir += cmake::GetCMakeFilesDirectory();
     {
     std::ostringstream progCmd;
@@ -1862,7 +1862,7 @@ void cmLocalUnixMakefileGenerator3
   commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(),
                                                 recursiveTarget));
   this->CreateCDCommand(commands,
-                        this->Makefile->GetHomeOutputDirectory(),
+                        this->GetBinaryDirectory(),
                         cmLocalGenerator::START_OUTPUT);
     {
     std::ostringstream progCmd;
@@ -1884,7 +1884,7 @@ void cmLocalUnixMakefileGenerator3
   commands.push_back(this->GetRecursiveMakeCall(mf2Dir.c_str(),
                                                 recursiveTarget));
   this->CreateCDCommand(commands,
-                                this->Makefile->GetHomeOutputDirectory(),
+                                this->GetBinaryDirectory(),
                                 cmLocalGenerator::START_OUTPUT);
   this->WriteMakeRule(ruleFileStream, "The main clean target", "clean",
                       depends, commands, true);
@@ -1914,7 +1914,7 @@ void cmLocalUnixMakefileGenerator3
   commands.push_back
     (this->GetRecursiveMakeCall(mf2Dir.c_str(), recursiveTarget));
   this->CreateCDCommand(commands,
-                        this->Makefile->GetHomeOutputDirectory(),
+                        this->GetBinaryDirectory(),
                         cmLocalGenerator::START_OUTPUT);
   this->WriteMakeRule(ruleFileStream, "Prepare targets for installation.",
                       "preinstall", depends, commands, true);
@@ -1935,7 +1935,7 @@ void cmLocalUnixMakefileGenerator3
   runRule += " 1";
   commands.push_back(runRule);
   this->CreateCDCommand(commands,
-                        this->Makefile->GetHomeOutputDirectory(),
+                        this->GetBinaryDirectory(),
                         cmLocalGenerator::START_OUTPUT);
   this->WriteMakeRule(ruleFileStream, "clear depends",
                       "depend",

+ 3 - 3
Source/cmLocalVisualStudio6Generator.cxx

@@ -112,7 +112,7 @@ void cmLocalVisualStudio6Generator::OutputDSPFile()
 {
   // If not an in source build, then create the output directory
   if(strcmp(this->Makefile->GetCurrentBinaryDirectory(),
-            this->Makefile->GetHomeDirectory()) != 0)
+            this->GetSourceDirectory()) != 0)
     {
     if(!cmSystemTools::MakeDirectory
        (this->Makefile->GetCurrentBinaryDirectory()))
@@ -226,10 +226,10 @@ void cmLocalVisualStudio6Generator::AddDSPBuildRule(cmTarget& tgt)
   comment += makefileIn;
   std::string args;
   args = "-H";
-  args += this->Makefile->GetHomeDirectory();
+  args += this->GetSourceDirectory();
   commandLine.push_back(args);
   args = "-B";
-  args += this->Makefile->GetHomeOutputDirectory();
+  args += this->GetBinaryDirectory();
   commandLine.push_back(args);
 
   std::vector<std::string> const& listFiles = this->Makefile->GetListFiles();

+ 3 - 3
Source/cmLocalVisualStudio7Generator.cxx

@@ -165,7 +165,7 @@ void cmLocalVisualStudio7Generator::WriteProjectFiles()
 {
   // If not an in source build, then create the output directory
   if(strcmp(this->Makefile->GetCurrentBinaryDirectory(),
-            this->Makefile->GetHomeDirectory()) != 0)
+            this->GetSourceDirectory()) != 0)
     {
     if(!cmSystemTools::MakeDirectory
        (this->Makefile->GetCurrentBinaryDirectory()))
@@ -294,10 +294,10 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
   comment += makefileIn;
   std::string args;
   args = "-H";
-  args += this->Makefile->GetHomeDirectory();
+  args += this->GetSourceDirectory();
   commandLine.push_back(args);
   args = "-B";
-  args += this->Makefile->GetHomeOutputDirectory();
+  args += this->GetBinaryDirectory();
   commandLine.push_back(args);
   commandLine.push_back("--check-stamp-file");
   std::string stampFilename = this->Convert(stampName.c_str(), FULL,

+ 4 - 4
Source/cmMakefileTargetGenerator.cxx

@@ -1095,7 +1095,7 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
   // translation table for the dependency scanning process.
   depCmd << "cd "
          << (this->LocalGenerator->Convert(
-               this->Makefile->GetHomeOutputDirectory(),
+               this->LocalGenerator->GetBinaryDirectory(),
                cmLocalGenerator::FULL, cmLocalGenerator::SHELL))
          << " && ";
 #endif
@@ -1110,13 +1110,13 @@ void cmMakefileTargetGenerator::WriteTargetDependRules()
   // the state of our local generator sufficiently for its needs.
   depCmd << "$(CMAKE_COMMAND) -E cmake_depends \""
          << this->GlobalGenerator->GetName() << "\" "
-         << this->Convert(this->Makefile->GetHomeDirectory(),
+         << this->Convert(this->LocalGenerator->GetSourceDirectory(),
                           cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
          << " "
          << this->Convert(this->Makefile->GetCurrentSourceDirectory(),
                           cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
          << " "
-         << this->Convert(this->Makefile->GetHomeOutputDirectory(),
+         << this->Convert(this->LocalGenerator->GetBinaryDirectory(),
                           cmLocalGenerator::FULL, cmLocalGenerator::SHELL)
          << " "
          << this->Convert(this->Makefile->GetCurrentBinaryDirectory(),
@@ -1242,7 +1242,7 @@ void
 cmMakefileTargetGenerator
 ::MakeEchoProgress(cmLocalUnixMakefileGenerator3::EchoProgress& progress) const
 {
-  progress.Dir = this->Makefile->GetHomeOutputDirectory();
+  progress.Dir = this->LocalGenerator->GetBinaryDirectory();
   progress.Dir += cmake::GetCMakeFilesDirectory();
   std::ostringstream progressArg;
   progressArg << "$(CMAKE_PROGRESS_" << this->NumberOfProgressActions << ")";

+ 2 - 2
Source/cmNinjaNormalTargetGenerator.cxx

@@ -666,8 +666,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
   if (!preLinkCmdLines.empty())
     {
     const std::string homeOutDir = localGen.ConvertToOutputFormat(
-                                              mf->GetHomeOutputDirectory(),
-                                              cmLocalGenerator::SHELL);
+                                            localGen.GetBinaryDirectory(),
+                                            cmLocalGenerator::SHELL);
     preLinkCmdLines.push_back("cd " + homeOutDir);
     }
 

+ 1 - 1
Source/cmNinjaTargetGenerator.cxx

@@ -47,7 +47,7 @@ cmNinjaTargetGenerator::New(cmGeneratorTarget* target)
         // in every directory, which we don't need.
         cmMakefile *mf = target->Target->GetMakefile();
         if (strcmp(mf->GetCurrentSourceDirectory(),
-                   mf->GetHomeDirectory()) == 0)
+                   target->GetLocalGenerator()->GetSourceDirectory()) == 0)
           return new cmNinjaUtilityTargetGenerator(target);
         // else fallthrough
       }

+ 2 - 2
Source/cmNinjaUtilityTargetGenerator.cxx

@@ -103,13 +103,13 @@ void cmNinjaUtilityTargetGenerator::Generate()
       command,
       "$(CMAKE_SOURCE_DIR)",
       this->GetLocalGenerator()->ConvertToOutputFormat(
-        this->GetTarget()->GetMakefile()->GetHomeDirectory(),
+        this->GetLocalGenerator()->GetSourceDirectory(),
         cmLocalGenerator::SHELL).c_str());
     cmSystemTools::ReplaceString(
       command,
       "$(CMAKE_BINARY_DIR)",
       this->GetLocalGenerator()->ConvertToOutputFormat(
-        this->GetTarget()->GetMakefile()->GetHomeOutputDirectory(),
+        this->GetLocalGenerator()->GetBinaryDirectory(),
         cmLocalGenerator::SHELL).c_str());
     cmSystemTools::ReplaceString(command, "$(ARGS)", "");