[cmake-commits] hoffman committed cmake.cxx 1.358 1.359 cmake.h 1.99 1.100

cmake-commits at cmake.org cmake-commits at cmake.org
Tue Feb 12 09:49:44 EST 2008


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

Modified Files:
	cmake.cxx cmake.h 
Log Message:
ENH: fix make edit_cache for cmake-gui


Index: cmake.h
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.h,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -d -r1.99 -r1.100
--- cmake.h	17 Jan 2008 23:13:55 -0000	1.99
+++ cmake.h	12 Feb 2008 14:49:42 -0000	1.100
@@ -329,6 +329,10 @@
   // Define the properties
   static void DefineProperties(cmake *cm);
 
+  void SetCMakeEditCommand(const char* s)
+    {
+      this->CMakeEditCommand = s;
+    }
 protected:
   int HandleDeleteCacheVariables(const char* var);
   cmPropertyMap Properties;
@@ -413,6 +417,7 @@
   bool InTryCompile;
   bool ScriptMode;
   bool DebugOutput;
+  std::string CMakeEditCommand;
   std::string CMakeCommand;
   std::string CXXEnvironment;
   std::string CCEnvironment;

Index: cmake.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/cmake.cxx,v
retrieving revision 1.358
retrieving revision 1.359
diff -u -d -r1.358 -r1.359
--- cmake.cxx	11 Feb 2008 22:00:36 -0000	1.358
+++ cmake.cxx	12 Feb 2008 14:49:42 -0000	1.359
@@ -756,20 +756,39 @@
   this->CacheManager->AddCacheEntry
     ("CMAKE_COMMAND",cMakeSelf.c_str(), "Path to CMake executable.",
      cmCacheManager::INTERNAL);
-
-  // Find and save the command to edit the cache
-  std::string editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) +
-    "/ccmake" + cmSystemTools::GetFilenameExtension(cMakeSelf);
-  if( !cmSystemTools::FileExists(editCacheCommand.c_str()))
-    {
-    editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) +
-      "/CMakeSetup" + cmSystemTools::GetFilenameExtension(cMakeSelf);
-    }
-  if(cmSystemTools::FileExists(editCacheCommand.c_str()))
+  // if the edit command is not yet in the cache, 
+  // or if CMakeEditCommand has been set on this object,
+  // then set the CMAKE_EDIT_COMMAND in the cache
+  // This will mean that the last gui to edit the cache
+  // will be the one that make edit_cache uses.
+  if(!this->GetCacheDefinition("CMAKE_EDIT_COMMAND") 
+    || !this->CMakeEditCommand.empty())
     {
-    this->CacheManager->AddCacheEntry
-      ("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
-       "Path to cache edit program executable.", cmCacheManager::INTERNAL);
+    // Find and save the command to edit the cache
+    std::string editCacheCommand;
+    if(!this->CMakeEditCommand.empty())
+      {
+      editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf)
+        + std::string("/") 
+        + this->CMakeEditCommand 
+        + cmSystemTools::GetFilenameExtension(cMakeSelf);
+      }
+    if( !cmSystemTools::FileExists(editCacheCommand.c_str()))
+      {
+      editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) +
+        "/ccmake" + cmSystemTools::GetFilenameExtension(cMakeSelf);
+      }
+    if( !cmSystemTools::FileExists(editCacheCommand.c_str()))
+      {
+      editCacheCommand = cmSystemTools::GetFilenamePath(cMakeSelf) +
+        "/CMakeSetup" + cmSystemTools::GetFilenameExtension(cMakeSelf);
+      }
+    if(cmSystemTools::FileExists(editCacheCommand.c_str()))
+      {
+      this->CacheManager->AddCacheEntry
+        ("CMAKE_EDIT_COMMAND", editCacheCommand.c_str(),
+         "Path to cache edit program executable.", cmCacheManager::INTERNAL);
+      }
     }
   std::string ctestCommand = cmSystemTools::GetFilenamePath(cMakeSelf) +
     "/ctest" + cmSystemTools::GetFilenameExtension(cMakeSelf);



More information about the Cmake-commits mailing list