[cmake-commits] king committed cmGlobalVisualStudio7Generator.cxx 1.93 1.94 cmGlobalVisualStudio8Generator.cxx 1.27 1.28 cmGlobalVisualStudioGenerator.cxx 1.6 1.7 cmGlobalVisualStudioGenerator.h 1.4 1.5

cmake-commits at cmake.org cmake-commits at cmake.org
Mon Nov 19 13:44:53 EST 2007


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

Modified Files:
	cmGlobalVisualStudio7Generator.cxx 
	cmGlobalVisualStudio8Generator.cxx 
	cmGlobalVisualStudioGenerator.cxx 
	cmGlobalVisualStudioGenerator.h 
Log Message:
ENH: Renamed cmGlobalVisualStudioGenerator::CallVisualStudioReloadMacro method to CallVisualStudioMacro and added arguments to select which macro to call and optionally pass the solution file name.  Added option to call to new StopBuild macro.  Updated logic for replacing the macro file in user directories when the distributed version is newer.


Index: cmGlobalVisualStudioGenerator.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudioGenerator.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- cmGlobalVisualStudioGenerator.h	16 Nov 2007 12:01:58 -0000	1.4
+++ cmGlobalVisualStudioGenerator.h	19 Nov 2007 18:44:51 -0000	1.5
@@ -49,11 +49,14 @@
    */
   virtual std::string GetUserMacrosDirectory();
 
+  enum MacroName {MacroReload, MacroStop};
+
   /**
    * Call the ReloadProjects macro if necessary based on
    * GetFilesReplacedDuringGenerate results.
    */
-  virtual void CallVisualStudioReloadMacro();
+  virtual void CallVisualStudioMacro(MacroName m,
+                                     const char* vsSolutionFile = 0);
 
 protected:
   virtual void CreateGUID(const char*) {}

Index: cmGlobalVisualStudio7Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio7Generator.cxx,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- cmGlobalVisualStudio7Generator.cxx	16 Nov 2007 16:01:23 -0000	1.93
+++ cmGlobalVisualStudio7Generator.cxx	19 Nov 2007 18:44:51 -0000	1.94
@@ -224,7 +224,7 @@
   // tell Visual Studio to reload them...
   if(!cmSystemTools::GetErrorOccuredFlag())
     {
-    this->CallVisualStudioReloadMacro();
+    this->CallVisualStudioMacro(MacroReload);
     }
 }
 

Index: cmGlobalVisualStudioGenerator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudioGenerator.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- cmGlobalVisualStudioGenerator.cxx	16 Nov 2007 18:54:21 -0000	1.6
+++ cmGlobalVisualStudioGenerator.cxx	19 Nov 2007 18:44:51 -0000	1.7
@@ -79,6 +79,9 @@
 #define CMAKE_VSMACROS_RELOAD_MACRONAME \
   "Macros.CMakeVSMacros1.Macros.ReloadProjects"
 
+#define CMAKE_VSMACROS_STOP_MACRONAME \
+  "Macros.CMakeVSMacros1.Macros.StopBuild"
+
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudioGenerator::ConfigureCMakeVisualStudioMacros()
 {
@@ -92,9 +95,14 @@
 
     std::string dst = dir + "/CMakeMacros/" CMAKE_VSMACROS_FILENAME;
 
-    // Only copy if dst does not already exist. Write this file initially,
-    // but never overwrite local mods.
-    if (!cmSystemTools::FileExists(dst.c_str()))
+    // Copy the macros file to the user directory only if the
+    // destination does not exist or the source location is newer.
+    // This will allow the user to edit the macros for development
+    // purposes but newer versions distributed with CMake will replace
+    // older versions in user directories.
+    int res;
+    if(!cmSystemTools::FileTimeCompare(src.c_str(), dst.c_str(), &res) ||
+       res > 0)
       {
       if (!cmSystemTools::CopyFileAlways(src.c_str(), dst.c_str()))
         {
@@ -110,7 +118,10 @@
 }
 
 //----------------------------------------------------------------------------
-void cmGlobalVisualStudioGenerator::CallVisualStudioReloadMacro()
+void
+cmGlobalVisualStudioGenerator
+::CallVisualStudioMacro(MacroName m,
+                        const char* vsSolutionFile)
 {
   // If any solution or project files changed during the generation,
   // tell Visual Studio to reload them...
@@ -132,31 +143,46 @@
       IsVisualStudioMacrosFileRegistered(macrosFile, nextSubkeyName)
       )
       {
-      std::vector<std::string> filenames;
-      this->GetFilesReplacedDuringGenerate(filenames);
-      if (filenames.size() > 0)
+      std::string topLevelSlnName;
+      if(vsSolutionFile)
         {
-        // Convert vector to semi-colon delimited string of filenames:
-        std::string projects;
-        std::vector<std::string>::iterator it = filenames.begin();
-        if (it != filenames.end())
-          {
-          projects = *it;
-          ++it;
-          }
-        for (; it != filenames.end(); ++it)
-          {
-          projects += ";";
-          projects += *it;
-          }
-
-        std::string topLevelSlnName = mf->GetStartOutputDirectory();
+        topLevelSlnName = vsSolutionFile;
+        }
+      else
+        {
+        topLevelSlnName = mf->GetStartOutputDirectory();
         topLevelSlnName += "/";
         topLevelSlnName += mf->GetProjectName();
         topLevelSlnName += ".sln";
+        }
 
+      if(m == MacroReload)
+        {
+        std::vector<std::string> filenames;
+        this->GetFilesReplacedDuringGenerate(filenames);
+        if (filenames.size() > 0)
+          {
+          // Convert vector to semi-colon delimited string of filenames:
+          std::string projects;
+          std::vector<std::string>::iterator it = filenames.begin();
+          if (it != filenames.end())
+            {
+            projects = *it;
+            ++it;
+            }
+          for (; it != filenames.end(); ++it)
+            {
+            projects += ";";
+            projects += *it;
+            }
+          cmCallVisualStudioMacro::CallMacro
+            (topLevelSlnName, CMAKE_VSMACROS_RELOAD_MACRONAME, projects);
+          }
+        }
+      else if(m == MacroStop)
+        {
         cmCallVisualStudioMacro::CallMacro(topLevelSlnName,
-          CMAKE_VSMACROS_RELOAD_MACRONAME, projects);
+          CMAKE_VSMACROS_STOP_MACRONAME, "");
         }
       }
     }

Index: cmGlobalVisualStudio8Generator.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmGlobalVisualStudio8Generator.cxx,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- cmGlobalVisualStudio8Generator.cxx	16 Nov 2007 16:01:23 -0000	1.27
+++ cmGlobalVisualStudio8Generator.cxx	19 Nov 2007 18:44:51 -0000	1.28
@@ -169,6 +169,8 @@
         commandLine.push_back(argB);
         commandLine.push_back("--check-stamp-file");
         commandLine.push_back(stampName.c_str());
+        commandLine.push_back("--vs-solution-file");
+        commandLine.push_back("\"$(SolutionPath)\"");
         cmCustomCommandLines commandLines;
         commandLines.push_back(commandLine);
 



More information about the Cmake-commits mailing list