[Cmake-commits] [cmake-commits] king committed cmGlobalVisualStudio7Generator.cxx 1.112 1.113 cmGlobalVisualStudio7Generator.h 1.54 1.55 cmGlobalVisualStudio8Generator.cxx 1.40 1.41 cmGlobalVisualStudio8Generator.h 1.17 1.18

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Oct 19 10:47:36 EDT 2009


Update of /cvsroot/CMake/CMake/Source
In directory public:/mounts/ram/cvs-serv32533/Source

Modified Files:
	cmGlobalVisualStudio7Generator.cxx 
	cmGlobalVisualStudio7Generator.h 
	cmGlobalVisualStudio8Generator.cxx 
	cmGlobalVisualStudio8Generator.h 
Log Message:
Avoid duplicate ZERO_CHECK in VS solutions

The commit "Avoid non-root copies of root-only targets" moved the check
for root-only targets into cmGlobalGenerator::GetTargetSets to avoid
adding multiple ALL_BUILD targets to the "original" target set.  This
approach did not work for ZERO_CHECK targets though because those are
pulled in by dependency analysis.

Instead we eliminate duplicate ZERO_CHECK targets altogether and refer
to a single one from all solution files.  This cleans up VS 10 project
file references to ZERO_CHECK targets anyway.


Index: cmGlobalVisualStudio7Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.h,v
retrieving revision 1.54
retrieving revision 1.55
diff -C 2 -d -r1.54 -r1.55
*** cmGlobalVisualStudio7Generator.h	6 Oct 2009 17:30:00 -0000	1.54
--- cmGlobalVisualStudio7Generator.h	19 Oct 2009 14:47:34 -0000	1.55
***************
*** 134,138 ****
    std::string ConvertToSolutionPath(const char* path);
  
-   virtual bool IsRootOnlyTarget(cmTarget* target);
    bool IsPartOfDefaultBuild(const char* project,
                              cmTarget* target);
--- 134,137 ----

Index: cmGlobalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.cxx,v
retrieving revision 1.112
retrieving revision 1.113
diff -C 2 -d -r1.112 -r1.113
*** cmGlobalVisualStudio7Generator.cxx	6 Oct 2009 17:30:00 -0000	1.112
--- cmGlobalVisualStudio7Generator.cxx	19 Oct 2009 14:47:34 -0000	1.113
***************
*** 616,626 ****
  }
  
- //----------------------------------------------------------------------------
- bool cmGlobalVisualStudio7Generator::IsRootOnlyTarget(cmTarget* target)
- {
-   return (this->cmGlobalVisualStudioGenerator::IsRootOnlyTarget(target) ||
-           strcmp(target->GetName(), CMAKE_CHECK_BUILD_SYSTEM_TARGET) == 0);
- }
- 
  bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project,
                                                            cmTarget* target)
--- 616,619 ----

Index: cmGlobalVisualStudio8Generator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio8Generator.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C 2 -d -r1.17 -r1.18
*** cmGlobalVisualStudio8Generator.h	28 Sep 2009 15:42:41 -0000	1.17
--- cmGlobalVisualStudio8Generator.h	19 Oct 2009 14:47:34 -0000	1.18
***************
*** 64,67 ****
--- 64,69 ----
    virtual bool VSLinksDependencies() const { return false; }
  
+   void AddCheckTarget();
+ 
    static cmIDEFlagTable const* GetExtraFlagTableVS8();
    virtual void AddPlatformDefinitions(cmMakefile* mf);

Index: cmGlobalVisualStudio8Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio8Generator.cxx,v
retrieving revision 1.40
retrieving revision 1.41
diff -C 2 -d -r1.40 -r1.41
*** cmGlobalVisualStudio8Generator.cxx	28 Sep 2009 15:42:41 -0000	1.40
--- cmGlobalVisualStudio8Generator.cxx	19 Oct 2009 14:47:34 -0000	1.41
***************
*** 111,115 ****
  
  //----------------------------------------------------------------------------
! void cmGlobalVisualStudio8Generator::Generate()
  {
    // Add a special target on which all other targets depend that
--- 111,115 ----
  
  //----------------------------------------------------------------------------
! void cmGlobalVisualStudio8Generator::AddCheckTarget()
  {
    // Add a special target on which all other targets depend that
***************
*** 117,240 ****
    const char* no_working_directory = 0;
    std::vector<std::string> no_depends;
!   std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
!   for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
!     {
!     std::vector<cmLocalGenerator*>& generators = it->second;
!     if(!generators.empty())
!       {
!       // Add the build-system check target to the first local
!       // generator of this project.
!       cmLocalVisualStudio7Generator* lg =
!         static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
!       cmMakefile* mf = lg->GetMakefile();
  
!       // Skip the target if no regeneration is to be done.
!       if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION"))
!         {
!         continue;
!         }
  
!       std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
!       cmCustomCommandLines noCommandLines;
!       mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
!                             no_working_directory, no_depends,
!                             noCommandLines);
!       cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
!       if(!tgt)
!         {
!         cmSystemTools::Error("Error adding target " 
!                              CMAKE_CHECK_BUILD_SYSTEM_TARGET);
!         continue;
!         }
  
!       // Create a list of all stamp files for this project.
!       std::vector<std::string> stamps;
!       std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash();
!       stampList += "generate.stamp.list";
!       {
!       std::string stampListFile =
!         generators[0]->GetMakefile()->GetCurrentOutputDirectory();
!       stampListFile += "/";
!       stampListFile += stampList;
!       std::string stampFile;
!       cmGeneratedFileStream fout(stampListFile.c_str());
!       for(std::vector<cmLocalGenerator*>::const_iterator
!             gi = generators.begin(); gi != generators.end(); ++gi)
!         {
!         stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory();
!         stampFile += "/";
!         stampFile += cmake::GetCMakeFilesDirectoryPostSlash();
!         stampFile += "generate.stamp";
!         stampFile = generators[0]->Convert(stampFile.c_str(),
!                                            cmLocalGenerator::START_OUTPUT);
!         fout << stampFile << "\n";
!         stamps.push_back(stampFile);
!         }
!       }
  
!       // Add a custom rule to re-run CMake if any input files changed.
!       {
!       // Collect the input files used to generate all targets in this
!       // project.
!       std::vector<std::string> listFiles;
!       for(unsigned int j = 0; j < generators.size(); ++j)
!         {
!         cmMakefile* lmf = generators[j]->GetMakefile();
!         listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(),
!                          lmf->GetListFiles().end());
!         }
!       // Sort the list of input files and remove duplicates.
!       std::sort(listFiles.begin(), listFiles.end(),
!                 std::less<std::string>());
!       std::vector<std::string>::iterator new_end =
!         std::unique(listFiles.begin(), listFiles.end());
!       listFiles.erase(new_end, listFiles.end());
  
!       // Create a rule to re-run CMake.
!       std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash();
!       stampName += "generate.stamp";
!       const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND");
!       cmCustomCommandLine commandLine;
!       commandLine.push_back(dsprule);
!       std::string argH = "-H";
!       argH += lg->Convert(mf->GetHomeDirectory(),
!                           cmLocalGenerator::START_OUTPUT,
!                           cmLocalGenerator::UNCHANGED, true);
!       commandLine.push_back(argH);
!       std::string argB = "-B";
!       argB += lg->Convert(mf->GetHomeOutputDirectory(),
!                           cmLocalGenerator::START_OUTPUT,
!                           cmLocalGenerator::UNCHANGED, true);
!       commandLine.push_back(argB);
!       commandLine.push_back("--check-stamp-list");
!       commandLine.push_back(stampList.c_str());
!       commandLine.push_back("--vs-solution-file");
!       commandLine.push_back("\"$(SolutionPath)\"");
!       cmCustomCommandLines commandLines;
!       commandLines.push_back(commandLine);
  
!       // Add the rule.  Note that we cannot use the CMakeLists.txt
!       // file as the main dependency because it would get
!       // overwritten by the CreateVCProjBuildRule.
!       // (this could be avoided with per-target source files)
!       const char* no_main_dependency = 0;
!       const char* no_working_directory = 0;
!       mf->AddCustomCommandToOutput(
!         stamps, listFiles,
!         no_main_dependency, commandLines, "Checking Build System",
!         no_working_directory, true);
!       std::string ruleName = stamps[0];
!       ruleName += ".rule";
!       if(cmSourceFile* file = mf->GetSource(ruleName.c_str()))
!         {
!         tgt->AddSourceFile(file);
!         }
!       else
!         {
!         cmSystemTools::Error("Error adding rule for ", stamps[0].c_str());
!         }
!       }
!       }
      }
  
    // All targets depend on the build-system check target.
--- 117,231 ----
    const char* no_working_directory = 0;
    std::vector<std::string> no_depends;
!   std::vector<cmLocalGenerator*> const& generators = this->LocalGenerators;
!   cmLocalVisualStudio7Generator* lg =
!     static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
!   cmMakefile* mf = lg->GetMakefile();
  
!   // Skip the target if no regeneration is to be done.
!   if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION"))
!     {
!     return;
!     }
  
!   std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
!   cmCustomCommandLines noCommandLines;
!   cmTarget* tgt =
!     mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
!                           no_working_directory, no_depends,
!                           noCommandLines);
  
!   // Create a list of all stamp files for this project.
!   std::vector<std::string> stamps;
!   std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash();
!   stampList += "generate.stamp.list";
!   {
!   std::string stampListFile =
!     generators[0]->GetMakefile()->GetCurrentOutputDirectory();
!   stampListFile += "/";
!   stampListFile += stampList;
!   std::string stampFile;
!   cmGeneratedFileStream fout(stampListFile.c_str());
!   for(std::vector<cmLocalGenerator*>::const_iterator
!         gi = generators.begin(); gi != generators.end(); ++gi)
!     {
!     stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory();
!     stampFile += "/";
!     stampFile += cmake::GetCMakeFilesDirectoryPostSlash();
!     stampFile += "generate.stamp";
!     stampFile = generators[0]->Convert(stampFile.c_str(),
!                                        cmLocalGenerator::START_OUTPUT);
!     fout << stampFile << "\n";
!     stamps.push_back(stampFile);
!     }
!   }
  
!   // Add a custom rule to re-run CMake if any input files changed.
!   {
!   // Collect the input files used to generate all targets in this
!   // project.
!   std::vector<std::string> listFiles;
!   for(unsigned int j = 0; j < generators.size(); ++j)
!     {
!     cmMakefile* lmf = generators[j]->GetMakefile();
!     listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(),
!                      lmf->GetListFiles().end());
!     }
!   // Sort the list of input files and remove duplicates.
!   std::sort(listFiles.begin(), listFiles.end(),
!             std::less<std::string>());
!   std::vector<std::string>::iterator new_end =
!     std::unique(listFiles.begin(), listFiles.end());
!   listFiles.erase(new_end, listFiles.end());
  
!   // Create a rule to re-run CMake.
!   std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash();
!   stampName += "generate.stamp";
!   const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND");
!   cmCustomCommandLine commandLine;
!   commandLine.push_back(dsprule);
!   std::string argH = "-H";
!   argH += lg->Convert(mf->GetHomeDirectory(),
!                       cmLocalGenerator::START_OUTPUT,
!                       cmLocalGenerator::UNCHANGED, true);
!   commandLine.push_back(argH);
!   std::string argB = "-B";
!   argB += lg->Convert(mf->GetHomeOutputDirectory(),
!                       cmLocalGenerator::START_OUTPUT,
!                       cmLocalGenerator::UNCHANGED, true);
!   commandLine.push_back(argB);
!   commandLine.push_back("--check-stamp-list");
!   commandLine.push_back(stampList.c_str());
!   commandLine.push_back("--vs-solution-file");
!   commandLine.push_back("\"$(SolutionPath)\"");
!   cmCustomCommandLines commandLines;
!   commandLines.push_back(commandLine);
  
!   // Add the rule.  Note that we cannot use the CMakeLists.txt
!   // file as the main dependency because it would get
!   // overwritten by the CreateVCProjBuildRule.
!   // (this could be avoided with per-target source files)
!   const char* no_main_dependency = 0;
!   const char* no_working_directory = 0;
!   mf->AddCustomCommandToOutput(
!     stamps, listFiles,
!     no_main_dependency, commandLines, "Checking Build System",
!     no_working_directory, true);
!   std::string ruleName = stamps[0];
!   ruleName += ".rule";
!   if(cmSourceFile* file = mf->GetSource(ruleName.c_str()))
!     {
!     tgt->AddSourceFile(file);
      }
+   else
+     {
+     cmSystemTools::Error("Error adding rule for ", stamps[0].c_str());
+     }
+   }
+ }
+ 
+ //----------------------------------------------------------------------------
+ void cmGlobalVisualStudio8Generator::Generate()
+ {
+   this->AddCheckTarget();
  
    // All targets depend on the build-system check target.



More information about the Cmake-commits mailing list