[cmake-commits] david.cole committed SystemTools.cxx 1.209 1.210

cmake-commits at cmake.org cmake-commits at cmake.org
Fri Nov 16 07:02:00 EST 2007


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

Modified Files:
	SystemTools.cxx 
Log Message:
ENH: Add ability to call Visual Studio macros from CMake. Add a CMake Visual Studio macro to reload a solution file automatically if CMake makes changes to .sln files or .vcproj files. Add code to call the macro automatically for any running Visual Studio instances with the .sln file open at the end of the Visual Studio Generate call. Only call the macro if some .sln or .vcproj file changed during Generate. Also, add handling for REG_EXPAND_SZ type to SystemTools::ReadRegistryValue - returned string has environment variable references expanded.


Index: SystemTools.cxx
===================================================================
RCS file: /cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v
retrieving revision 1.209
retrieving revision 1.210
diff -u -d -r1.209 -r1.210
--- SystemTools.cxx	7 Nov 2007 13:59:29 -0000	1.209
+++ SystemTools.cxx	16 Nov 2007 12:01:58 -0000	1.210
@@ -492,11 +492,11 @@
 #if defined(_WIN32) && !defined(__CYGWIN__)
 bool SystemTools::ReadRegistryValue(const char *key, kwsys_stl::string &value)
 {
-
+  bool valueset = false;
   kwsys_stl::string primary = key;
   kwsys_stl::string second;
   kwsys_stl::string valuename;
- 
+
   size_t start = primary.find("\\");
   if (start == kwsys_stl::string::npos)
     {
@@ -558,12 +558,24 @@
       if (dwType == REG_SZ)
         {
         value = data;
-        RegCloseKey(hKey);
-        return true;
+        valueset = true;
+        }
+      else if (dwType == REG_EXPAND_SZ)
+        {
+        char expanded[1024];
+        DWORD dwExpandedSize = sizeof(expanded)/sizeof(expanded[0]);
+        if(ExpandEnvironmentStrings(data, expanded, dwExpandedSize))
+          {
+          value = expanded;
+          valueset = true;
+          }
         }
       }
+
+    RegCloseKey(hKey);
     }
-  return false;
+
+  return valueset;
 }
 #else
 bool SystemTools::ReadRegistryValue(const char *, kwsys_stl::string &)



More information about the Cmake-commits mailing list