? cpack-multiple-configurations.diff
Index: cmCPackGenericGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackGenericGenerator.cxx,v
retrieving revision 1.47
diff -u -w -r1.47 cmCPackGenericGenerator.cxx
--- cmCPackGenericGenerator.cxx	3 Aug 2007 19:26:30 -0000	1.47
+++ cmCPackGenericGenerator.cxx	11 Aug 2007 03:36:46 -0000
@@ -58,6 +58,28 @@
 }
 
 //----------------------------------------------------------------------
+int cmCPackGenericGenerator::PrepareTempInstallDirectory()
+{
+  cmCPackLogger(cmCPackLog::LOG_OUTPUT,
+                "Clean temporary installation directory" << std::endl);
+  this->CleanTemporaryDirectory();
+  std::string tempInstallDirectoryWithPostfix
+    = this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
+  tempInstallDirectoryWithPostfix
+    += this->GetTemporaryInstallDirectoryPostfix();
+  const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
+  if ( !cmsys::SystemTools::MakeDirectory(tempInstallDirectory))
+    {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+      "Problem creating temporary directory: "
+                  << (tempInstallDirectory ? tempInstallDirectory : "(NULL}")
+      << std::endl);
+    return 0;
+    }
+  return 1;
+}
+
+//----------------------------------------------------------------------
 int cmCPackGenericGenerator::PrepareNames()
 {
   this->SetOption("CPACK_GENERATOR", this->Name.c_str());
@@ -144,21 +166,11 @@
 int cmCPackGenericGenerator::InstallProject()
 {
   cmCPackLogger(cmCPackLog::LOG_OUTPUT, "Install projects" << std::endl);
-  this->CleanTemporaryDirectory();
   std::string tempInstallDirectoryWithPostfix
     = this->GetOption("CPACK_TEMPORARY_INSTALL_DIRECTORY");
   tempInstallDirectoryWithPostfix
     += this->GetTemporaryInstallDirectoryPostfix();
   const char* tempInstallDirectory = tempInstallDirectoryWithPostfix.c_str();
-  int res = 1;
-  if ( !cmsys::SystemTools::MakeDirectory(tempInstallDirectory))
-    {
-    cmCPackLogger(cmCPackLog::LOG_ERROR,
-      "Problem creating temporary directory: " 
-                  << (tempInstallDirectory ? tempInstallDirectory : "(NULL}")
-                  << std::endl);
-    return 0;
-    }
 
   bool movable = true;
   if ( movable )
@@ -212,7 +224,7 @@
     cmSystemTools::PutEnv("DESTDIR=");
     }
 
-  return res;
+  return 1;
 }
 
 //----------------------------------------------------------------------
@@ -615,10 +627,29 @@
         }
       }
     }
+  if ( !this->PrepareTempInstallDirectory() )
+    return 0;
+
+  const char* configurationsList = this->GetOption("CPACK_BUILD_CONFIGURATIONS");
+  if (!configurationsList || !*configurationsList)
+    {
   if ( !this->InstallProject() )
+      return 0;
+    }
+  else
+    {
+    std::vector<std::string> configurationsVector;
+    cmSystemTools::ExpandListArgument(configurationsList,
+                                      configurationsVector);
+    std::vector<std::string>::iterator it;
+    for ( it = configurationsVector.begin(); it != configurationsVector.end(); ++it )
     {
+      const char* configuration = it->c_str();
+      this->SetOption("CPACK_BUILD_CONFIG", configuration);
+      if ( !this->InstallProject() )
     return 0;
     }
+    }
 
   const char* tempPackageFileName = this->GetOption(
     "CPACK_TEMPORARY_PACKAGE_FILE_NAME");
Index: cmCPackGenericGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cmCPackGenericGenerator.h,v
retrieving revision 1.19
diff -u -w -r1.19 cmCPackGenericGenerator.h
--- cmCPackGenericGenerator.h	24 Jul 2007 16:52:37 -0000	1.19
+++ cmCPackGenericGenerator.h	11 Aug 2007 00:29:38 -0000
@@ -95,6 +95,7 @@
 
 protected:
   int PrepareNames();
+  int PrepareTempInstallDirectory();
   int InstallProject();
   int CleanTemporaryDirectory();
   virtual const char* GetOutputExtension() { return ".cpack"; }
Index: cpack.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/CPack/cpack.cxx,v
retrieving revision 1.35
diff -u -w -r1.35 cpack.cxx
--- cpack.cxx	3 Aug 2007 19:26:30 -0000	1.35
+++ cpack.cxx	11 Aug 2007 00:34:34 -0000
@@ -67,9 +67,9 @@
       "platforms. A generator is responsible for generating input files for "
       "particular system and invoking that systems. Possible generator names "
       "are specified in the Generators section." },
-    {"-C <Configuration>", "Specify the project configuration",
-    "This option specifies the configuration that the project was build "
-      "with, for example 'Debug', 'Release'." },
+    {"-C <Configurations>", "Specify the project configurations (semi-colon separated list)",
+    "This option specifies the configurations that the project was build "
+      "with, for example 'Debug', 'Release', or 'Release;Debug'." },
     {"-D <var>=<value>", "Set a CPack variable.", \
     "Set a variable that can be used by the generator."}, \
     {"--config <config file>", "Specify the config file.",
@@ -313,7 +313,7 @@
       }
     if ( !cpackBuildConfig.empty() )
       {
-      globalMF->AddDefinition("CPACK_BUILD_CONFIG", cpackBuildConfig.c_str());
+      globalMF->AddDefinition("CPACK_BUILD_CONFIGURATIONS", cpackBuildConfig.c_str());
       }
     cpackDefinitions::MapType::iterator cdit;
     for ( cdit = definitions.Map.begin();
