[Cmake-commits] CMake branch, next, updated. v3.4.0-rc1-185-ge6bfc5e

Stephen Kelly steveire at gmail.com
Wed Oct 7 17:07:53 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  e6bfc5ee5271cb6ff29152a1684452f432e5dff6 (commit)
       via  3a3af1790faa93f90d5d2b728ab67c2cebd26248 (commit)
       via  b2ee4cb71be4fc8960b17303e19d0512362bab9f (commit)
      from  a8e25daac7e967cb8ca9c7c71710b424c28041f3 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e6bfc5ee5271cb6ff29152a1684452f432e5dff6
commit e6bfc5ee5271cb6ff29152a1684452f432e5dff6
Merge: a8e25da 3a3af17
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 7 17:07:52 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Wed Oct 7 17:07:52 2015 -0400

    Merge topic 'add-cmLocalGenerator-API' into next
    
    3a3af179 Revert topic.
    b2ee4cb7 cmMakefile: Inline initialization of project name.


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3a3af1790faa93f90d5d2b728ab67c2cebd26248
commit 3a3af1790faa93f90d5d2b728ab67c2cebd26248
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 7 23:07:22 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 7 23:07:30 2015 +0200

    Revert topic.

diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index e3efcdd..7da334e 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -116,7 +116,7 @@ const char* CCONV cmGetProjectName(void *arg)
 {
   cmMakefile *mf = static_cast<cmMakefile *>(arg);
   static std::string name;
-  name = mf->GetStateSnapshot().GetProjectName();
+  name = mf->GetProjectName();
   return name.c_str();
 }
 
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 2a9b72c..881acee 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -241,12 +241,12 @@ static bool isSubDirectory(const char* a, const char* b)
 
 //----------------------------------------------------------------------------
 static bool checkInterfaceDirs(const std::string &prepro,
-                      cmGeneratorTarget *target, const std::string& prop)
+                      cmTarget *target, const std::string& prop)
 {
   const char* installDir =
-            target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
-  const char* topSourceDir = target->Makefile->GetHomeDirectory();
-  const char* topBinaryDir = target->Makefile->GetHomeOutputDirectory();
+            target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
+  const char* topSourceDir = target->GetMakefile()->GetHomeDirectory();
+  const char* topBinaryDir = target->GetMakefile()->GetHomeOutputDirectory();
 
   std::vector<std::string> parts;
   cmGeneratorExpression::Split(prepro, parts);
@@ -269,7 +269,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
       {
       if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
         {
-        switch (target->Target->GetPolicyStatusCMP0041())
+        switch (target->GetPolicyStatusCMP0041())
           {
           case cmPolicies::WARN:
             messageType = cmake::WARNING;
@@ -298,7 +298,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
       e << "Target \"" << target->GetName() << "\" " << prop <<
            " property contains relative path:\n"
            "  \"" << *li << "\"";
-      target->GetLocalGenerator()->IssueMessage(messageType, e.str());
+      target->GetMakefile()->IssueMessage(messageType, e.str());
       }
     bool inBinary = isSubDirectory(li->c_str(), topBinaryDir);
     bool inSource = isSubDirectory(li->c_str(), topSourceDir);
@@ -316,7 +316,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
         {
         if (!shouldContinue)
           {
-          switch(target->Target->GetPolicyStatusCMP0052())
+          switch(target->GetPolicyStatusCMP0052())
             {
             case cmPolicies::WARN:
               {
@@ -329,7 +329,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
                 "a subdirectory of the " << (inBinary ? "build" : "source")
                 << " tree:\n    \"" << (inBinary ? topBinaryDir : topSourceDir)
                 << "\"" << std::endl;
-              target->GetLocalGenerator()->IssueMessage(cmake::AUTHOR_WARNING,
+              target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING,
                                                   s.str());
               }
             case cmPolicies::OLD:
@@ -352,7 +352,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
       e << "Target \"" << target->GetName() << "\" " << prop <<
            " property contains path:\n"
            "  \"" << *li << "\"\nwhich is prefixed in the build directory.";
-      target->GetLocalGenerator()->IssueMessage(messageType, e.str());
+      target->GetMakefile()->IssueMessage(messageType, e.str());
       }
     if (!inSourceBuild)
       {
@@ -361,7 +361,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
         e << "Target \"" << target->GetName() << "\" " << prop <<
             " property contains path:\n"
             "  \"" << *li << "\"\nwhich is prefixed in the source directory.";
-        target->GetLocalGenerator()->IssueMessage(messageType, e.str());
+        target->GetMakefile()->IssueMessage(messageType, e.str());
         }
       }
     }
@@ -421,9 +421,7 @@ void cmExportFileGenerator::PopulateSourcesInterface(
     this->ResolveTargetsInGeneratorExpressions(prepro, target,
                                                 missingTargets);
 
-    cmGeneratorTarget* gt = target->GetMakefile()
-        ->GetGlobalGenerator()->GetGeneratorTarget(target);
-    if (!checkInterfaceDirs(prepro, gt, propName))
+    if (!checkInterfaceDirs(prepro, target, propName))
       {
       return;
       }
@@ -493,7 +491,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
     this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
                                                 missingTargets);
 
-    if (!checkInterfaceDirs(prepro, target, propName))
+    if (!checkInterfaceDirs(prepro, target->Target, propName))
       {
       return;
       }
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index 408daab..dfd51c7 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -78,7 +78,7 @@ void cmExtraCodeBlocksGenerator::CreateProjectFile(
 {
   const cmMakefile* mf=lgs[0]->GetMakefile();
   std::string outputDir=mf->GetCurrentBinaryDirectory();
-  std::string projectName=lgs[0]->GetProjectName();
+  std::string projectName=mf->GetProjectName();
 
   std::string filename=outputDir+"/";
   filename+=projectName+".cbp";
@@ -307,7 +307,7 @@ void cmExtraCodeBlocksGenerator
         "<CodeBlocks_project_file>\n"
         "   <FileVersion major=\"1\" minor=\"6\" />\n"
         "   <Project>\n"
-        "      <Option title=\"" << lgs[0]->GetProjectName()<<"\" />\n"
+        "      <Option title=\"" << mf->GetProjectName()<<"\" />\n"
         "      <Option makefile_is_custom=\"1\" />\n"
         "      <Option compiler=\"" << compiler << "\" />\n"
         "      "<<virtualFolders<<"\n"
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index 1884da1..c2cff14 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -72,7 +72,7 @@ void cmExtraCodeLiteGenerator::Generate()
                mf->GetHomeOutputDirectory()) == 0)
       {
       workspaceOutputDir   = mf->GetCurrentBinaryDirectory();
-      workspaceProjectName = it->second[0]->GetProjectName();
+      workspaceProjectName = mf->GetProjectName();
       workspaceSourcePath  = mf->GetHomeDirectory();
       workspaceFileName    = workspaceOutputDir+"/";
       workspaceFileName   += workspaceProjectName + ".workspace";
@@ -93,7 +93,7 @@ void cmExtraCodeLiteGenerator::Generate()
     // retrive project information
     const cmMakefile* mf    = it->second[0]->GetMakefile();
     std::string outputDir   = mf->GetCurrentBinaryDirectory();
-    std::string projectName = it->second[0]->GetProjectName();
+    std::string projectName = mf->GetProjectName();
     std::string filename    = outputDir + "/" + projectName + ".project";
 
     // Make the project file relative to the workspace
@@ -123,7 +123,7 @@ void cmExtraCodeLiteGenerator::CreateProjectFile(
 {
   const cmMakefile* mf    = lgs[0]->GetMakefile();
   std::string outputDir   = mf->GetCurrentBinaryDirectory();
-  std::string projectName = lgs[0]->GetProjectName();
+  std::string projectName = mf->GetProjectName();
   std::string filename    = outputDir + "/";
 
   filename += projectName + ".project";
@@ -143,7 +143,7 @@ void cmExtraCodeLiteGenerator
 
   ////////////////////////////////////
   fout << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
-       "<CodeLite_Project Name=\"" << lgs[0]->GetProjectName()
+       "<CodeLite_Project Name=\"" << mf->GetProjectName()
        << "\" InternalType=\"\">\n";
 
   // Collect all used source files in the project
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 659a9ae..44bf586 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -157,8 +157,9 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
   assert(this->HomeDirectory != this->HomeOutputDirectory);
 
   // set up the project name: <project>-Source@<baseSourcePathName>
-  cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
-  std::string name = this->GenerateProjectName(lg->GetProjectName(), "Source",
+  const cmMakefile* mf
+     = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
+  std::string name = this->GenerateProjectName(mf->GetProjectName(), "Source",
                                    this->GetPathBasename(this->HomeDirectory));
 
   const std::string filename = this->HomeDirectory + "/.project";
@@ -196,11 +197,8 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
 
 //----------------------------------------------------------------------------
 void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
-                                            const char* envVar,
-                                            cmLocalGenerator* lg)
+                                            const char* envVar, cmMakefile* mf)
 {
-  cmMakefile* mf = lg->GetMakefile();
-
   // get the variables from the environment and from the cache and then
   // figure out which one to use:
 
@@ -261,8 +259,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
 //----------------------------------------------------------------------------
 void cmExtraEclipseCDT4Generator::CreateProjectFile()
 {
-  cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
-  cmMakefile* mf = lg->GetMakefile();
+  cmMakefile* mf
+    = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
 
   const std::string filename = this->HomeOutputDirectory + "/.project";
 
@@ -282,7 +280,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
     "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
     "<projectDescription>\n"
     "\t<name>" <<
-    this->GenerateProjectName(lg->GetProjectName(),
+    this->GenerateProjectName(mf->GetProjectName(),
                               mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
                               this->GetPathBasename(this->HomeOutputDirectory))
     << "</name>\n"
@@ -363,17 +361,17 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
   //   but not necessarily when eclipse is open
   if (compilerId == "MSVC")
     {
-    AddEnvVar(fout, "PATH", lg);
-    AddEnvVar(fout, "INCLUDE", lg);
-    AddEnvVar(fout, "LIB", lg);
-    AddEnvVar(fout, "LIBPATH", lg);
+    AddEnvVar(fout, "PATH", mf);
+    AddEnvVar(fout, "INCLUDE", mf);
+    AddEnvVar(fout, "LIB", mf);
+    AddEnvVar(fout, "LIBPATH", mf);
     }
   else if (compilerId == "Intel")
     {
     // if the env.var is set, use this one and put it in the cache
     // if the env.var is not set, but the value is in the cache,
     // use it from the cache:
-    AddEnvVar(fout, "INTEL_LICENSE_FILE", lg);
+    AddEnvVar(fout, "INTEL_LICENSE_FILE", mf);
     }
   fout <<
     "</value>\n"
@@ -696,8 +694,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
 {
   std::set<std::string> emmited;
 
-  cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
-  const cmMakefile* mf = lg->GetMakefile();
+  const cmMakefile* mf
+    = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
 
   const std::string filename = this->HomeOutputDirectory + "/.cproject";
 
@@ -1151,8 +1149,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
   fout << "</cconfiguration>\n"
           "</storageModule>\n"
           "<storageModule moduleId=\"cdtBuildSystem\" version=\"4.0.0\">\n"
-          "<project id=\"" << this->EscapeForXML(lg->GetProjectName())
-       << ".null.1\" name=\"" << this->EscapeForXML(lg->GetProjectName())
+          "<project id=\"" << this->EscapeForXML(mf->GetProjectName())
+       << ".null.1\" name=\"" << this->EscapeForXML(mf->GetProjectName())
        << "\"/>\n"
           "</storageModule>\n"
           "</cproject>\n"
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index 16675f2..ef99760 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -100,7 +100,7 @@ private:
                                    std::set<std::string>& emittedDirs);
 
   static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
-                        cmLocalGenerator* lg);
+                        cmMakefile* mf);
 
   void CreateLinksToSubprojects(cmGeneratedFileStream& fout,
                                 const std::string& baseDir);
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index 104372c..f83b5cf 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -46,22 +46,20 @@ cmExtraKateGenerator::cmExtraKateGenerator()
 
 void cmExtraKateGenerator::Generate()
 {
-  cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
-  const cmMakefile* mf = lg->GetMakefile();
-  this->ProjectName = this->GenerateProjectName(lg->GetProjectName(),
+  const cmMakefile* mf
+     = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
+  this->ProjectName = this->GenerateProjectName(mf->GetProjectName(),
                           mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
                           this->GetPathBasename(mf->GetHomeOutputDirectory()));
   this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja");
 
-  this->CreateKateProjectFile(lg);
-  this->CreateDummyKateProjectFile(lg);
+  this->CreateKateProjectFile(mf);
+  this->CreateDummyKateProjectFile(mf);
 }
 
 
-void cmExtraKateGenerator::CreateKateProjectFile(
-    const cmLocalGenerator* lg) const
+void cmExtraKateGenerator::CreateKateProjectFile(const cmMakefile* mf) const
 {
-  const cmMakefile* mf = lg->GetMakefile();
   std::string filename = mf->GetHomeOutputDirectory();
   filename += "/.kateproject";
   cmGeneratedFileStream fout(filename.c_str());
@@ -70,6 +68,9 @@ void cmExtraKateGenerator::CreateKateProjectFile(
     return;
     }
 
+  std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
+  std::string args = mf->GetSafeDefinition("CMAKE_KATE_MAKE_ARGUMENTS");
+
   fout <<
     "{\n"
     "\t\"name\": \"" << this->ProjectName << "\",\n"
@@ -81,10 +82,9 @@ void cmExtraKateGenerator::CreateKateProjectFile(
 
 
 void
-cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
+cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
                                    cmGeneratedFileStream& fout) const
 {
-  cmMakefile* mf = lg->GetMakefile();
   const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
   const std::string makeArgs = mf->GetSafeDefinition(
     "CMAKE_KATE_MAKE_ARGUMENTS");
@@ -234,10 +234,8 @@ cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout,
 
 
 void
-cmExtraKateGenerator::CreateDummyKateProjectFile(
-    const cmLocalGenerator* lg) const
+cmExtraKateGenerator::CreateDummyKateProjectFile(const cmMakefile* mf) const
 {
-  cmMakefile* mf = lg->GetMakefile();
   std::string filename = mf->GetHomeOutputDirectory();
   filename += "/";
   filename += this->ProjectName;
@@ -254,9 +252,8 @@ cmExtraKateGenerator::CreateDummyKateProjectFile(
 
 
 std::string
-cmExtraKateGenerator::GenerateFilesString(const cmLocalGenerator* lg) const
+cmExtraKateGenerator::GenerateFilesString(const cmMakefile* mf) const
 {
-  cmMakefile* mf = lg->GetMakefile();
   std::string s = mf->GetHomeDirectory();
   s += "/.git";
   if(cmSystemTools::FileExists(s.c_str()))
diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h
index b20d0a7..f800feb 100644
--- a/Source/cmExtraKateGenerator.h
+++ b/Source/cmExtraKateGenerator.h
@@ -39,10 +39,9 @@ public:
 
   virtual void Generate();
 private:
-  void CreateKateProjectFile(const cmLocalGenerator* lg) const;
-  void CreateDummyKateProjectFile(const cmLocalGenerator* lg) const;
-  void WriteTargets(const cmLocalGenerator* lg,
-                    cmGeneratedFileStream& fout) const;
+  void CreateKateProjectFile(const cmMakefile* mf) const;
+  void CreateDummyKateProjectFile(const cmMakefile* mf) const;
+  void WriteTargets(const cmMakefile* mf, cmGeneratedFileStream& fout) const;
   void AppendTarget(cmGeneratedFileStream& fout,
                     const std::string&     target,
                     const std::string&     make,
@@ -50,7 +49,7 @@ private:
                     const std::string&     path,
                     const char*            homeOutputDir) const;
 
-  std::string GenerateFilesString(const cmLocalGenerator* lg) const;
+  std::string GenerateFilesString(const cmMakefile* mf) const;
   std::string GetPathBasename(const std::string& path) const;
   std::string GenerateProjectName(const std::string& name,
                                   const std::string& type,
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 363ab2f..163a75b 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -79,7 +79,7 @@ void cmExtraSublimeTextGenerator::CreateProjectFile(
 {
   const cmMakefile* mf=lgs[0]->GetMakefile();
   std::string outputDir=mf->GetCurrentBinaryDirectory();
-  std::string projectName=lgs[0]->GetProjectName();
+  std::string projectName=mf->GetProjectName();
 
   const std::string filename =
                      outputDir + "/" + projectName + ".sublime-project";
@@ -302,7 +302,7 @@ void cmExtraSublimeTextGenerator::
     {
     fout << ",\n\t";
     }
-  fout << "\t{\n\t\t\t\"name\": \"" << lg->GetProjectName() << " - " <<
+  fout << "\t{\n\t\t\t\"name\": \"" << makefile->GetProjectName() << " - " <<
           targetName << "\",\n";
   fout << "\t\t\t\"cmd\": [" <<
           this->BuildMakeCommand(make, makefileName.c_str(), targetName) <<
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index 6290907..138ddbb 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -52,7 +52,7 @@ void cmGlobalKdevelopGenerator::Generate()
     cmMakefile* mf = it->second[0]->GetMakefile();
     std::string outputDir=mf->GetCurrentBinaryDirectory();
     std::string projectDir=mf->GetHomeDirectory();
-    std::string projectName=it->second[0]->GetProjectName();
+    std::string projectName=mf->GetProjectName();
     std::string cmakeFilePattern("CMakeLists.txt;*.cmake;");
     std::string fileToOpen;
     const std::vector<cmLocalGenerator*>& lgs= it->second;
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index d5e9417..14de698 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -260,7 +260,7 @@ void cmGlobalVisualStudio6Generator
     }
   std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory();
   fname += "/";
-  fname += root->GetProjectName();
+  fname += root->GetMakefile()->GetProjectName();
   fname += ".dsw";
   cmsys::ofstream fout(fname.c_str());
   if(!fout)
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 73a952b..05da022 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -362,10 +362,10 @@ void cmGlobalVisualStudio7Generator
     {
     return;
     }
-  this->CurrentProject = root->GetProjectName();
+  this->CurrentProject = root->GetMakefile()->GetProjectName();
   std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory();
   fname += "/";
-  fname += root->GetProjectName();
+  fname += root->GetMakefile()->GetProjectName();
   fname += ".sln";
   cmGeneratedFileStream fout(fname.c_str());
   fout.SetCopyIfDifferent(true);
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 6a25ed0..d45aa27 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -250,7 +250,7 @@ cmGlobalVisualStudioGenerator
         {
         topLevelSlnName = mf->GetCurrentBinaryDirectory();
         topLevelSlnName += "/";
-        topLevelSlnName += this->LocalGenerators[0]->GetProjectName();
+        topLevelSlnName += mf->GetProjectName();
         topLevelSlnName += ".sln";
         }
 
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 840e89f..746e1a7 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -410,7 +410,7 @@ void cmGlobalXCodeGenerator::Generate()
 //----------------------------------------------------------------------------
 void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root)
 {
-  this->CurrentProject = root->GetProjectName();
+  this->CurrentProject = root->GetMakefile()->GetProjectName();
   this->SetCurrentLocalGenerator(root);
   cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(),
                            this->ProjectSourceDirectoryComponents);
@@ -3339,7 +3339,7 @@ bool cmGlobalXCodeGenerator
   this->RootObject->SetComment("Project object");
 
   std::string project_id = "PROJECT_";
-  project_id += root->GetProjectName();
+  project_id += root->GetMakefile()->GetProjectName();
   this->RootObject->SetId(this->GetOrCreateId(
     project_id.c_str(), this->RootObject->GetId()).c_str());
 
@@ -3726,7 +3726,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
     }
   std::string xcodeDir = root->GetMakefile()->GetCurrentBinaryDirectory();
   xcodeDir += "/";
-  xcodeDir += root->GetProjectName();
+  xcodeDir += root->GetMakefile()->GetProjectName();
   xcodeDir += ".xcode";
   if(this->XcodeVersion > 20)
     {
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b7833cd..b26151c 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2431,11 +2431,6 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
   return 0;
 }
 
-std::string cmLocalGenerator::GetProjectName() const
-{
-  return this->StateSnapshot.GetProjectName();
-}
-
 //----------------------------------------------------------------------------
 std::string
 cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg,
@@ -2863,11 +2858,6 @@ cmLocalGenerator
   return source.GetLanguage();
 }
 
-cmake* cmLocalGenerator::GetCMakeInstance() const
-{
-  return this->GlobalGenerator->GetCMakeInstance();
-}
-
 //----------------------------------------------------------------------------
 std::string
 cmLocalGenerator::GetTargetDirectory(cmTarget const&) const
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index b3bf8cd..33fede1 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -182,8 +182,6 @@ public:
                              const std::string& config,
                              const std::string& lang);
 
-  std::string GetProjectName() const;
-
   /** Compute the language used to compile the given source file.  */
   std::string GetSourceFileLanguage(const cmSourceFile& source);
 
@@ -253,8 +251,6 @@ public:
    */
   bool NeedBackwardsCompatibility_2_4();
 
-  cmake* GetCMakeInstance() const;
-
   /**
    * Generate a Mac OS X application bundle Info.plist file.
    */
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index b1e1d3f..c46adc1 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -183,7 +183,7 @@ void cmLocalNinjaGenerator::WriteProjectHeader(std::ostream& os)
 {
   cmGlobalNinjaGenerator::WriteDivider(os);
   os
-    << "# Project: " << this->GetProjectName() << std::endl
+    << "# Project: " << this->GetMakefile()->GetProjectName() << std::endl
     << "# Configuration: " << this->ConfigName << std::endl
     ;
   cmGlobalNinjaGenerator::WriteDivider(os);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 5caa272..077470d 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1517,7 +1517,7 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
                     parent->GetProperty("LINK_DIRECTORIES"));
 
   // the initial project name
-  this->StateSnapshot.SetProjectName(parent->StateSnapshot.GetProjectName());
+  this->SetProjectName(parent->GetProjectName());
 
   // Copy include regular expressions.
   this->ComplainFileRegularExpression = parent->ComplainFileRegularExpression;
@@ -2033,6 +2033,11 @@ void cmMakefile::SetProjectName(std::string const& p)
   this->StateSnapshot.SetProjectName(p);
 }
 
+std::string cmMakefile::GetProjectName() const
+{
+  return this->StateSnapshot.GetProjectName();
+}
+
 void cmMakefile::AddGlobalLinkInformation(const std::string& name,
                                           cmTarget& target)
 {
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 7057157..8724c6e 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -274,6 +274,11 @@ public:
    */
   void SetProjectName(std::string const& name);
 
+  /**
+   * Get the name of the project for this build.
+   */
+  std::string GetProjectName() const;
+
   /** Get the configurations to be generated.  */
   std::string GetConfigurations(std::vector<std::string>& configs,
                                 bool single = true) const;

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b2ee4cb71be4fc8960b17303e19d0512362bab9f
commit b2ee4cb71be4fc8960b17303e19d0512362bab9f
Author:     Stephen Kelly <steveire at gmail.com>
AuthorDate: Wed Oct 7 00:17:20 2015 +0200
Commit:     Stephen Kelly <steveire at gmail.com>
CommitDate: Wed Oct 7 23:07:19 2015 +0200

    cmMakefile: Inline initialization of project name.

diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx
index 7da334e..e3efcdd 100644
--- a/Source/cmCPluginAPI.cxx
+++ b/Source/cmCPluginAPI.cxx
@@ -116,7 +116,7 @@ const char* CCONV cmGetProjectName(void *arg)
 {
   cmMakefile *mf = static_cast<cmMakefile *>(arg);
   static std::string name;
-  name = mf->GetProjectName();
+  name = mf->GetStateSnapshot().GetProjectName();
   return name.c_str();
 }
 
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 881acee..2a9b72c 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -241,12 +241,12 @@ static bool isSubDirectory(const char* a, const char* b)
 
 //----------------------------------------------------------------------------
 static bool checkInterfaceDirs(const std::string &prepro,
-                      cmTarget *target, const std::string& prop)
+                      cmGeneratorTarget *target, const std::string& prop)
 {
   const char* installDir =
-            target->GetMakefile()->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
-  const char* topSourceDir = target->GetMakefile()->GetHomeDirectory();
-  const char* topBinaryDir = target->GetMakefile()->GetHomeOutputDirectory();
+            target->Makefile->GetSafeDefinition("CMAKE_INSTALL_PREFIX");
+  const char* topSourceDir = target->Makefile->GetHomeDirectory();
+  const char* topBinaryDir = target->Makefile->GetHomeOutputDirectory();
 
   std::vector<std::string> parts;
   cmGeneratorExpression::Split(prepro, parts);
@@ -269,7 +269,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
       {
       if (prop == "INTERFACE_INCLUDE_DIRECTORIES")
         {
-        switch (target->GetPolicyStatusCMP0041())
+        switch (target->Target->GetPolicyStatusCMP0041())
           {
           case cmPolicies::WARN:
             messageType = cmake::WARNING;
@@ -298,7 +298,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
       e << "Target \"" << target->GetName() << "\" " << prop <<
            " property contains relative path:\n"
            "  \"" << *li << "\"";
-      target->GetMakefile()->IssueMessage(messageType, e.str());
+      target->GetLocalGenerator()->IssueMessage(messageType, e.str());
       }
     bool inBinary = isSubDirectory(li->c_str(), topBinaryDir);
     bool inSource = isSubDirectory(li->c_str(), topSourceDir);
@@ -316,7 +316,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
         {
         if (!shouldContinue)
           {
-          switch(target->GetPolicyStatusCMP0052())
+          switch(target->Target->GetPolicyStatusCMP0052())
             {
             case cmPolicies::WARN:
               {
@@ -329,7 +329,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
                 "a subdirectory of the " << (inBinary ? "build" : "source")
                 << " tree:\n    \"" << (inBinary ? topBinaryDir : topSourceDir)
                 << "\"" << std::endl;
-              target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING,
+              target->GetLocalGenerator()->IssueMessage(cmake::AUTHOR_WARNING,
                                                   s.str());
               }
             case cmPolicies::OLD:
@@ -352,7 +352,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
       e << "Target \"" << target->GetName() << "\" " << prop <<
            " property contains path:\n"
            "  \"" << *li << "\"\nwhich is prefixed in the build directory.";
-      target->GetMakefile()->IssueMessage(messageType, e.str());
+      target->GetLocalGenerator()->IssueMessage(messageType, e.str());
       }
     if (!inSourceBuild)
       {
@@ -361,7 +361,7 @@ static bool checkInterfaceDirs(const std::string &prepro,
         e << "Target \"" << target->GetName() << "\" " << prop <<
             " property contains path:\n"
             "  \"" << *li << "\"\nwhich is prefixed in the source directory.";
-        target->GetMakefile()->IssueMessage(messageType, e.str());
+        target->GetLocalGenerator()->IssueMessage(messageType, e.str());
         }
       }
     }
@@ -421,7 +421,9 @@ void cmExportFileGenerator::PopulateSourcesInterface(
     this->ResolveTargetsInGeneratorExpressions(prepro, target,
                                                 missingTargets);
 
-    if (!checkInterfaceDirs(prepro, target, propName))
+    cmGeneratorTarget* gt = target->GetMakefile()
+        ->GetGlobalGenerator()->GetGeneratorTarget(target);
+    if (!checkInterfaceDirs(prepro, gt, propName))
       {
       return;
       }
@@ -491,7 +493,7 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
     this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
                                                 missingTargets);
 
-    if (!checkInterfaceDirs(prepro, target->Target, propName))
+    if (!checkInterfaceDirs(prepro, target, propName))
       {
       return;
       }
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index dfd51c7..408daab 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -78,7 +78,7 @@ void cmExtraCodeBlocksGenerator::CreateProjectFile(
 {
   const cmMakefile* mf=lgs[0]->GetMakefile();
   std::string outputDir=mf->GetCurrentBinaryDirectory();
-  std::string projectName=mf->GetProjectName();
+  std::string projectName=lgs[0]->GetProjectName();
 
   std::string filename=outputDir+"/";
   filename+=projectName+".cbp";
@@ -307,7 +307,7 @@ void cmExtraCodeBlocksGenerator
         "<CodeBlocks_project_file>\n"
         "   <FileVersion major=\"1\" minor=\"6\" />\n"
         "   <Project>\n"
-        "      <Option title=\"" << mf->GetProjectName()<<"\" />\n"
+        "      <Option title=\"" << lgs[0]->GetProjectName()<<"\" />\n"
         "      <Option makefile_is_custom=\"1\" />\n"
         "      <Option compiler=\"" << compiler << "\" />\n"
         "      "<<virtualFolders<<"\n"
diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx
index c2cff14..1884da1 100644
--- a/Source/cmExtraCodeLiteGenerator.cxx
+++ b/Source/cmExtraCodeLiteGenerator.cxx
@@ -72,7 +72,7 @@ void cmExtraCodeLiteGenerator::Generate()
                mf->GetHomeOutputDirectory()) == 0)
       {
       workspaceOutputDir   = mf->GetCurrentBinaryDirectory();
-      workspaceProjectName = mf->GetProjectName();
+      workspaceProjectName = it->second[0]->GetProjectName();
       workspaceSourcePath  = mf->GetHomeDirectory();
       workspaceFileName    = workspaceOutputDir+"/";
       workspaceFileName   += workspaceProjectName + ".workspace";
@@ -93,7 +93,7 @@ void cmExtraCodeLiteGenerator::Generate()
     // retrive project information
     const cmMakefile* mf    = it->second[0]->GetMakefile();
     std::string outputDir   = mf->GetCurrentBinaryDirectory();
-    std::string projectName = mf->GetProjectName();
+    std::string projectName = it->second[0]->GetProjectName();
     std::string filename    = outputDir + "/" + projectName + ".project";
 
     // Make the project file relative to the workspace
@@ -123,7 +123,7 @@ void cmExtraCodeLiteGenerator::CreateProjectFile(
 {
   const cmMakefile* mf    = lgs[0]->GetMakefile();
   std::string outputDir   = mf->GetCurrentBinaryDirectory();
-  std::string projectName = mf->GetProjectName();
+  std::string projectName = lgs[0]->GetProjectName();
   std::string filename    = outputDir + "/";
 
   filename += projectName + ".project";
@@ -143,7 +143,7 @@ void cmExtraCodeLiteGenerator
 
   ////////////////////////////////////
   fout << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
-       "<CodeLite_Project Name=\"" << mf->GetProjectName()
+       "<CodeLite_Project Name=\"" << lgs[0]->GetProjectName()
        << "\" InternalType=\"\">\n";
 
   // Collect all used source files in the project
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 44bf586..659a9ae 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -157,9 +157,8 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
   assert(this->HomeDirectory != this->HomeOutputDirectory);
 
   // set up the project name: <project>-Source@<baseSourcePathName>
-  const cmMakefile* mf
-     = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
-  std::string name = this->GenerateProjectName(mf->GetProjectName(), "Source",
+  cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
+  std::string name = this->GenerateProjectName(lg->GetProjectName(), "Source",
                                    this->GetPathBasename(this->HomeDirectory));
 
   const std::string filename = this->HomeDirectory + "/.project";
@@ -197,8 +196,11 @@ void cmExtraEclipseCDT4Generator::CreateSourceProjectFile()
 
 //----------------------------------------------------------------------------
 void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
-                                            const char* envVar, cmMakefile* mf)
+                                            const char* envVar,
+                                            cmLocalGenerator* lg)
 {
+  cmMakefile* mf = lg->GetMakefile();
+
   // get the variables from the environment and from the cache and then
   // figure out which one to use:
 
@@ -259,8 +261,8 @@ void cmExtraEclipseCDT4Generator::AddEnvVar(cmGeneratedFileStream& fout,
 //----------------------------------------------------------------------------
 void cmExtraEclipseCDT4Generator::CreateProjectFile()
 {
-  cmMakefile* mf
-    = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
+  cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
+  cmMakefile* mf = lg->GetMakefile();
 
   const std::string filename = this->HomeOutputDirectory + "/.project";
 
@@ -280,7 +282,7 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
     "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
     "<projectDescription>\n"
     "\t<name>" <<
-    this->GenerateProjectName(mf->GetProjectName(),
+    this->GenerateProjectName(lg->GetProjectName(),
                               mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
                               this->GetPathBasename(this->HomeOutputDirectory))
     << "</name>\n"
@@ -361,17 +363,17 @@ void cmExtraEclipseCDT4Generator::CreateProjectFile()
   //   but not necessarily when eclipse is open
   if (compilerId == "MSVC")
     {
-    AddEnvVar(fout, "PATH", mf);
-    AddEnvVar(fout, "INCLUDE", mf);
-    AddEnvVar(fout, "LIB", mf);
-    AddEnvVar(fout, "LIBPATH", mf);
+    AddEnvVar(fout, "PATH", lg);
+    AddEnvVar(fout, "INCLUDE", lg);
+    AddEnvVar(fout, "LIB", lg);
+    AddEnvVar(fout, "LIBPATH", lg);
     }
   else if (compilerId == "Intel")
     {
     // if the env.var is set, use this one and put it in the cache
     // if the env.var is not set, but the value is in the cache,
     // use it from the cache:
-    AddEnvVar(fout, "INTEL_LICENSE_FILE", mf);
+    AddEnvVar(fout, "INTEL_LICENSE_FILE", lg);
     }
   fout <<
     "</value>\n"
@@ -694,8 +696,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
 {
   std::set<std::string> emmited;
 
-  const cmMakefile* mf
-    = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
+  cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
+  const cmMakefile* mf = lg->GetMakefile();
 
   const std::string filename = this->HomeOutputDirectory + "/.cproject";
 
@@ -1149,8 +1151,8 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
   fout << "</cconfiguration>\n"
           "</storageModule>\n"
           "<storageModule moduleId=\"cdtBuildSystem\" version=\"4.0.0\">\n"
-          "<project id=\"" << this->EscapeForXML(mf->GetProjectName())
-       << ".null.1\" name=\"" << this->EscapeForXML(mf->GetProjectName())
+          "<project id=\"" << this->EscapeForXML(lg->GetProjectName())
+       << ".null.1\" name=\"" << this->EscapeForXML(lg->GetProjectName())
        << "\"/>\n"
           "</storageModule>\n"
           "</cproject>\n"
diff --git a/Source/cmExtraEclipseCDT4Generator.h b/Source/cmExtraEclipseCDT4Generator.h
index ef99760..16675f2 100644
--- a/Source/cmExtraEclipseCDT4Generator.h
+++ b/Source/cmExtraEclipseCDT4Generator.h
@@ -100,7 +100,7 @@ private:
                                    std::set<std::string>& emittedDirs);
 
   static void AddEnvVar(cmGeneratedFileStream& fout, const char* envVar,
-                        cmMakefile* mf);
+                        cmLocalGenerator* lg);
 
   void CreateLinksToSubprojects(cmGeneratedFileStream& fout,
                                 const std::string& baseDir);
diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx
index f83b5cf..104372c 100644
--- a/Source/cmExtraKateGenerator.cxx
+++ b/Source/cmExtraKateGenerator.cxx
@@ -46,20 +46,22 @@ cmExtraKateGenerator::cmExtraKateGenerator()
 
 void cmExtraKateGenerator::Generate()
 {
-  const cmMakefile* mf
-     = this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile();
-  this->ProjectName = this->GenerateProjectName(mf->GetProjectName(),
+  cmLocalGenerator* lg = this->GlobalGenerator->GetLocalGenerators()[0];
+  const cmMakefile* mf = lg->GetMakefile();
+  this->ProjectName = this->GenerateProjectName(lg->GetProjectName(),
                           mf->GetSafeDefinition("CMAKE_BUILD_TYPE"),
                           this->GetPathBasename(mf->GetHomeOutputDirectory()));
   this->UseNinja = (this->GlobalGenerator->GetName() == "Ninja");
 
-  this->CreateKateProjectFile(mf);
-  this->CreateDummyKateProjectFile(mf);
+  this->CreateKateProjectFile(lg);
+  this->CreateDummyKateProjectFile(lg);
 }
 
 
-void cmExtraKateGenerator::CreateKateProjectFile(const cmMakefile* mf) const
+void cmExtraKateGenerator::CreateKateProjectFile(
+    const cmLocalGenerator* lg) const
 {
+  const cmMakefile* mf = lg->GetMakefile();
   std::string filename = mf->GetHomeOutputDirectory();
   filename += "/.kateproject";
   cmGeneratedFileStream fout(filename.c_str());
@@ -68,9 +70,6 @@ void cmExtraKateGenerator::CreateKateProjectFile(const cmMakefile* mf) const
     return;
     }
 
-  std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
-  std::string args = mf->GetSafeDefinition("CMAKE_KATE_MAKE_ARGUMENTS");
-
   fout <<
     "{\n"
     "\t\"name\": \"" << this->ProjectName << "\",\n"
@@ -82,9 +81,10 @@ void cmExtraKateGenerator::CreateKateProjectFile(const cmMakefile* mf) const
 
 
 void
-cmExtraKateGenerator::WriteTargets(const cmMakefile* mf,
+cmExtraKateGenerator::WriteTargets(const cmLocalGenerator* lg,
                                    cmGeneratedFileStream& fout) const
 {
+  cmMakefile* mf = lg->GetMakefile();
   const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM");
   const std::string makeArgs = mf->GetSafeDefinition(
     "CMAKE_KATE_MAKE_ARGUMENTS");
@@ -234,8 +234,10 @@ cmExtraKateGenerator::AppendTarget(cmGeneratedFileStream& fout,
 
 
 void
-cmExtraKateGenerator::CreateDummyKateProjectFile(const cmMakefile* mf) const
+cmExtraKateGenerator::CreateDummyKateProjectFile(
+    const cmLocalGenerator* lg) const
 {
+  cmMakefile* mf = lg->GetMakefile();
   std::string filename = mf->GetHomeOutputDirectory();
   filename += "/";
   filename += this->ProjectName;
@@ -252,8 +254,9 @@ cmExtraKateGenerator::CreateDummyKateProjectFile(const cmMakefile* mf) const
 
 
 std::string
-cmExtraKateGenerator::GenerateFilesString(const cmMakefile* mf) const
+cmExtraKateGenerator::GenerateFilesString(const cmLocalGenerator* lg) const
 {
+  cmMakefile* mf = lg->GetMakefile();
   std::string s = mf->GetHomeDirectory();
   s += "/.git";
   if(cmSystemTools::FileExists(s.c_str()))
diff --git a/Source/cmExtraKateGenerator.h b/Source/cmExtraKateGenerator.h
index f800feb..b20d0a7 100644
--- a/Source/cmExtraKateGenerator.h
+++ b/Source/cmExtraKateGenerator.h
@@ -39,9 +39,10 @@ public:
 
   virtual void Generate();
 private:
-  void CreateKateProjectFile(const cmMakefile* mf) const;
-  void CreateDummyKateProjectFile(const cmMakefile* mf) const;
-  void WriteTargets(const cmMakefile* mf, cmGeneratedFileStream& fout) const;
+  void CreateKateProjectFile(const cmLocalGenerator* lg) const;
+  void CreateDummyKateProjectFile(const cmLocalGenerator* lg) const;
+  void WriteTargets(const cmLocalGenerator* lg,
+                    cmGeneratedFileStream& fout) const;
   void AppendTarget(cmGeneratedFileStream& fout,
                     const std::string&     target,
                     const std::string&     make,
@@ -49,7 +50,7 @@ private:
                     const std::string&     path,
                     const char*            homeOutputDir) const;
 
-  std::string GenerateFilesString(const cmMakefile* mf) const;
+  std::string GenerateFilesString(const cmLocalGenerator* lg) const;
   std::string GetPathBasename(const std::string& path) const;
   std::string GenerateProjectName(const std::string& name,
                                   const std::string& type,
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 163a75b..363ab2f 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -79,7 +79,7 @@ void cmExtraSublimeTextGenerator::CreateProjectFile(
 {
   const cmMakefile* mf=lgs[0]->GetMakefile();
   std::string outputDir=mf->GetCurrentBinaryDirectory();
-  std::string projectName=mf->GetProjectName();
+  std::string projectName=lgs[0]->GetProjectName();
 
   const std::string filename =
                      outputDir + "/" + projectName + ".sublime-project";
@@ -302,7 +302,7 @@ void cmExtraSublimeTextGenerator::
     {
     fout << ",\n\t";
     }
-  fout << "\t{\n\t\t\t\"name\": \"" << makefile->GetProjectName() << " - " <<
+  fout << "\t{\n\t\t\t\"name\": \"" << lg->GetProjectName() << " - " <<
           targetName << "\",\n";
   fout << "\t\t\t\"cmd\": [" <<
           this->BuildMakeCommand(make, makefileName.c_str(), targetName) <<
diff --git a/Source/cmGlobalKdevelopGenerator.cxx b/Source/cmGlobalKdevelopGenerator.cxx
index 138ddbb..6290907 100644
--- a/Source/cmGlobalKdevelopGenerator.cxx
+++ b/Source/cmGlobalKdevelopGenerator.cxx
@@ -52,7 +52,7 @@ void cmGlobalKdevelopGenerator::Generate()
     cmMakefile* mf = it->second[0]->GetMakefile();
     std::string outputDir=mf->GetCurrentBinaryDirectory();
     std::string projectDir=mf->GetHomeDirectory();
-    std::string projectName=mf->GetProjectName();
+    std::string projectName=it->second[0]->GetProjectName();
     std::string cmakeFilePattern("CMakeLists.txt;*.cmake;");
     std::string fileToOpen;
     const std::vector<cmLocalGenerator*>& lgs= it->second;
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx
index 14de698..d5e9417 100644
--- a/Source/cmGlobalVisualStudio6Generator.cxx
+++ b/Source/cmGlobalVisualStudio6Generator.cxx
@@ -260,7 +260,7 @@ void cmGlobalVisualStudio6Generator
     }
   std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory();
   fname += "/";
-  fname += root->GetMakefile()->GetProjectName();
+  fname += root->GetProjectName();
   fname += ".dsw";
   cmsys::ofstream fout(fname.c_str());
   if(!fout)
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index 05da022..73a952b 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -362,10 +362,10 @@ void cmGlobalVisualStudio7Generator
     {
     return;
     }
-  this->CurrentProject = root->GetMakefile()->GetProjectName();
+  this->CurrentProject = root->GetProjectName();
   std::string fname = root->GetMakefile()->GetCurrentBinaryDirectory();
   fname += "/";
-  fname += root->GetMakefile()->GetProjectName();
+  fname += root->GetProjectName();
   fname += ".sln";
   cmGeneratedFileStream fout(fname.c_str());
   fout.SetCopyIfDifferent(true);
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index d45aa27..6a25ed0 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -250,7 +250,7 @@ cmGlobalVisualStudioGenerator
         {
         topLevelSlnName = mf->GetCurrentBinaryDirectory();
         topLevelSlnName += "/";
-        topLevelSlnName += mf->GetProjectName();
+        topLevelSlnName += this->LocalGenerators[0]->GetProjectName();
         topLevelSlnName += ".sln";
         }
 
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 746e1a7..840e89f 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -410,7 +410,7 @@ void cmGlobalXCodeGenerator::Generate()
 //----------------------------------------------------------------------------
 void cmGlobalXCodeGenerator::SetGenerationRoot(cmLocalGenerator* root)
 {
-  this->CurrentProject = root->GetMakefile()->GetProjectName();
+  this->CurrentProject = root->GetProjectName();
   this->SetCurrentLocalGenerator(root);
   cmSystemTools::SplitPath(this->CurrentMakefile->GetCurrentSourceDirectory(),
                            this->ProjectSourceDirectoryComponents);
@@ -3339,7 +3339,7 @@ bool cmGlobalXCodeGenerator
   this->RootObject->SetComment("Project object");
 
   std::string project_id = "PROJECT_";
-  project_id += root->GetMakefile()->GetProjectName();
+  project_id += root->GetProjectName();
   this->RootObject->SetId(this->GetOrCreateId(
     project_id.c_str(), this->RootObject->GetId()).c_str());
 
@@ -3726,7 +3726,7 @@ cmGlobalXCodeGenerator::OutputXCodeProject(cmLocalGenerator* root,
     }
   std::string xcodeDir = root->GetMakefile()->GetCurrentBinaryDirectory();
   xcodeDir += "/";
-  xcodeDir += root->GetMakefile()->GetProjectName();
+  xcodeDir += root->GetProjectName();
   xcodeDir += ".xcode";
   if(this->XcodeVersion > 20)
     {
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index b26151c..b7833cd 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -2431,6 +2431,11 @@ const char* cmLocalGenerator::GetFeature(const std::string& feature,
   return 0;
 }
 
+std::string cmLocalGenerator::GetProjectName() const
+{
+  return this->StateSnapshot.GetProjectName();
+}
+
 //----------------------------------------------------------------------------
 std::string
 cmLocalGenerator::ConstructComment(cmCustomCommandGenerator const& ccg,
@@ -2858,6 +2863,11 @@ cmLocalGenerator
   return source.GetLanguage();
 }
 
+cmake* cmLocalGenerator::GetCMakeInstance() const
+{
+  return this->GlobalGenerator->GetCMakeInstance();
+}
+
 //----------------------------------------------------------------------------
 std::string
 cmLocalGenerator::GetTargetDirectory(cmTarget const&) const
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 33fede1..b3bf8cd 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -182,6 +182,8 @@ public:
                              const std::string& config,
                              const std::string& lang);
 
+  std::string GetProjectName() const;
+
   /** Compute the language used to compile the given source file.  */
   std::string GetSourceFileLanguage(const cmSourceFile& source);
 
@@ -251,6 +253,8 @@ public:
    */
   bool NeedBackwardsCompatibility_2_4();
 
+  cmake* GetCMakeInstance() const;
+
   /**
    * Generate a Mac OS X application bundle Info.plist file.
    */
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index c46adc1..b1e1d3f 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -183,7 +183,7 @@ void cmLocalNinjaGenerator::WriteProjectHeader(std::ostream& os)
 {
   cmGlobalNinjaGenerator::WriteDivider(os);
   os
-    << "# Project: " << this->GetMakefile()->GetProjectName() << std::endl
+    << "# Project: " << this->GetProjectName() << std::endl
     << "# Configuration: " << this->ConfigName << std::endl
     ;
   cmGlobalNinjaGenerator::WriteDivider(os);
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 077470d..5caa272 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1517,7 +1517,7 @@ void cmMakefile::InitializeFromParent(cmMakefile* parent)
                     parent->GetProperty("LINK_DIRECTORIES"));
 
   // the initial project name
-  this->SetProjectName(parent->GetProjectName());
+  this->StateSnapshot.SetProjectName(parent->StateSnapshot.GetProjectName());
 
   // Copy include regular expressions.
   this->ComplainFileRegularExpression = parent->ComplainFileRegularExpression;
@@ -2033,11 +2033,6 @@ void cmMakefile::SetProjectName(std::string const& p)
   this->StateSnapshot.SetProjectName(p);
 }
 
-std::string cmMakefile::GetProjectName() const
-{
-  return this->StateSnapshot.GetProjectName();
-}
-
 void cmMakefile::AddGlobalLinkInformation(const std::string& name,
                                           cmTarget& target)
 {
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 8724c6e..7057157 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -274,11 +274,6 @@ public:
    */
   void SetProjectName(std::string const& name);
 
-  /**
-   * Get the name of the project for this build.
-   */
-  std::string GetProjectName() const;
-
   /** Get the configurations to be generated.  */
   std::string GetConfigurations(std::vector<std::string>& configs,
                                 bool single = true) const;

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list