[cmake-commits] andy committed cmGlobalGenerator.cxx 1.158 1.159 cmInstallTargetGenerator.cxx 1.21 1.22 cmake.cxx 1.271 1.272 cmake.h 1.71 1.72

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Oct 30 16:00:00 EST 2006


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

Modified Files:
	cmGlobalGenerator.cxx cmInstallTargetGenerator.cxx cmake.cxx 
	cmake.h 
Log Message:
ENH: Add support for displaying the list of components


Index: cmake.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -d -r1.71 -r1.72
--- cmake.h	6 Oct 2006 15:11:59 -0000	1.71
+++ cmake.h	30 Oct 2006 20:59:54 -0000	1.72
@@ -284,6 +284,12 @@
   // Do we want debug output during the cmake run.
   bool GetDebugOutput() { return this->DebugOutput; }
   void DebugOutputOn() { this->DebugOutput = true;}
+
+  //! Add or get installation components
+  void AddInstallComponent(const char* component);
+  std::set<cmStdString>* GetInstallComponents()
+  { return &this->InstallComponents; }
+
 protected:
   typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)();
   typedef std::map<cmStdString,
@@ -302,6 +308,8 @@
 
   std::set<cmStdString> WrittenFiles;
 
+  std::set<cmStdString> InstallComponents;
+
   ///! return true if the same cmake was used to make the cache.
   bool CacheVersionMatches();
   ///! read in a cmake list file to initialize the cache

Index: cmGlobalGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalGenerator.cxx,v
retrieving revision 1.158
retrieving revision 1.159
diff -u -d -r1.158 -r1.159
--- cmGlobalGenerator.cxx	12 Oct 2006 19:30:01 -0000	1.158
+++ cmGlobalGenerator.cxx	30 Oct 2006 20:59:53 -0000	1.159
@@ -1395,12 +1395,16 @@
     singleLine.erase(singleLine.begin(), singleLine.end());
     depends.erase(depends.begin(), depends.end());
     singleLine.push_back(this->GetCMakeInstance()->GetCTestCommand());
+    singleLine.push_back("--force-new-ctest-process");
     if(cmakeCfgIntDir && *cmakeCfgIntDir && cmakeCfgIntDir[0] != '.')
       {
       singleLine.push_back("-C");
       singleLine.push_back(mf->GetDefinition("CMAKE_CFG_INTDIR"));
       }
-    singleLine.push_back("--force-new-ctest-process");
+    else // TODO: This is a hack. Should be something to do with the generator
+      {
+      singleLine.push_back("$(ARGS)");
+      }
     cpackCommandLines.push_back(singleLine);
     (*targets)[this->GetTestTargetName()]
       = this->CreateGlobalTarget(this->GetTestTargetName(),
@@ -1464,9 +1468,40 @@
   //Install
   if(this->InstallTargetEnabled)
     {
+    if(!cmakeCfgIntDir || !*cmakeCfgIntDir || cmakeCfgIntDir[0] == '.')
+      {
+      std::set<cmStdString>* componentsSet
+        = this->GetCMakeInstance()->GetInstallComponents();
+      cpackCommandLines.erase(cpackCommandLines.begin(), 
+        cpackCommandLines.end());
+      depends.erase(depends.begin(), depends.end());
+      cmOStringStream ostr;
+      if ( componentsSet->size() > 0 )
+        {
+        ostr << "Available install components are:";
+        std::set<cmStdString>::iterator it;
+        for (
+          it = componentsSet->begin();
+          it != componentsSet->end();
+          ++ it )
+          {
+          ostr << " \"" << it->c_str() << "\"";
+          }
+        }
+      else
+        {
+        ostr << "Only default component available";
+        }
+      singleLine.push_back(ostr.str().c_str());
+      //cpackCommandLines.push_back(singleLine);
+      (*targets)["list_install_components"]
+        = this->CreateGlobalTarget("list_install_components",
+          ostr.str().c_str(),
+          &cpackCommandLines, depends);
+      }
     std::string cmd;
     cpackCommandLines.erase(cpackCommandLines.begin(),
-                            cpackCommandLines.end());
+      cpackCommandLines.end());
     singleLine.erase(singleLine.begin(), singleLine.end());
     depends.erase(depends.begin(), depends.end());
     if ( this->GetPreinstallTargetName() )
@@ -1518,7 +1553,7 @@
       {
       singleLine.insert(singleLine.begin()+1, "-DCMAKE_INSTALL_LOCAL_ONLY=1");
       cpackCommandLines.erase(cpackCommandLines.begin(),
-                              cpackCommandLines.end());
+        cpackCommandLines.end());
       cpackCommandLines.push_back(singleLine);
 
       (*targets)[install_local] =

Index: cmInstallTargetGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmInstallTargetGenerator.cxx,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- cmInstallTargetGenerator.cxx	5 Oct 2006 15:31:56 -0000	1.21
+++ cmInstallTargetGenerator.cxx	30 Oct 2006 20:59:54 -0000	1.22
@@ -33,6 +33,7 @@
   Component(component), Optional(optional)
 {
   this->Target->SetHaveInstallRule(true);
+  this->Target->GetMakefile()->GetCMakeInstance()->AddInstallComponent(component);
 }
 
 //----------------------------------------------------------------------------

Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.271
retrieving revision 1.272
diff -u -d -r1.271 -r1.272
--- cmake.cxx	23 Oct 2006 20:16:05 -0000	1.271
+++ cmake.cxx	30 Oct 2006 20:59:54 -0000	1.272
@@ -1307,6 +1307,18 @@
   return 1;
 }
 
+//----------------------------------------------------------------------------
+void cmake::AddInstallComponent(const char* component)
+{
+  if ( !component )
+    {
+    return;
+    }
+  this->InstallComponents.insert(component);
+}
+
+
+//----------------------------------------------------------------------------
 void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
 {
   for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin();



More information about the Cmake-commits mailing list