ENH: move more stuff over and get vs 9 working
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 230f214..254b8a2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,7 +7,7 @@
 SET(CMake_VERSION_MINOR 4)
 SET(CMake_VERSION_PATCH 8)
 # for an actual release this should not be defined
-SET(CMake_VERSION_RC 12)
+SET(CMake_VERSION_RC 13)
 SET(CMake_VERSION "${CMake_VERSION_MAJOR}.${CMake_VERSION_MINOR}")
 SET(CMake_VERSION_FULL "${CMake_VERSION}.${CMake_VERSION_PATCH}")
 
diff --git a/ChangeLog.manual b/ChangeLog.manual
index 8db6296..cf4a087 100644
--- a/ChangeLog.manual
+++ b/ChangeLog.manual
@@ -1,3 +1,7 @@
+Changes in CMake 2.4.8 RC 13
+* fix vs 9 so it works, again...
+* fix bug 6150, working directory can now change drives with vs custom commands
+* fix windows vista elevation issue with CMakeSetup.exe
 Changes in CMake 2.4.8 RC 12
 * Fix vs 9 so cmake can find it
 * Fix bug 6230 MODULE install with versions was broken
diff --git a/Source/MFCDialog/CMakeLists.txt b/Source/MFCDialog/CMakeLists.txt
index 060509f..3b1f3b9 100644
--- a/Source/MFCDialog/CMakeLists.txt
+++ b/Source/MFCDialog/CMakeLists.txt
@@ -30,4 +30,80 @@
 ADD_EXECUTABLE(CMakeSetup WIN32 ${SRCS})
 TARGET_LINK_LIBRARIES(CMakeSetup CMakeLib)
 ADD_DEPENDENCIES(CMakeSetup cmake)
+
+
+# some older versions of cmake do not have
+# a patch version set so we need to set it
+# so that a later if will not fail, this has
+# to be done all the time for all generators
+# since if statements are evaluated even if
+# inside a false if, they must still parse so for
+# if (CMAKE_PATCH_VERSION GREATER 4) not to
+# fail CMAKE_PATCH_VERSION must be set
+IF(${CMAKE_MAJOR_VERSION} LESS 3)
+  IF(NOT DEFINED CMAKE_PATCH_VERSION)
+    SET(CMAKE_PATCH_VERSION 0)
+  ENDIF(NOT DEFINED CMAKE_PATCH_VERSION)
+ENDIF(${CMAKE_MAJOR_VERSION} LESS 3)
+
+# for MSVC greater than 71 assume mt is around
+# for other versions allow for the cache to be
+# seeded with a value for CMAKE_MT_EXECUTABLE
+# this allows for MSVC71 to build CMakeSetup that
+# will have the manifest stuff for windows vista
+IF(MSVC AND NOT MSVC60 AND NOT MSVC70 AND NOT MSVC71)
+  SET(CMAKE_MT_EXECUTABLE mt)
+ENDIF(MSVC AND NOT MSVC60 AND NOT MSVC70 AND NOT MSVC71)
+IF(CMAKE_MT_EXECUTABLE)
+  SET(exe "${CMAKE_CFG_INTDIR}/CMakeSetup.exe")
+  IF(EXECUTABLE_OUTPUT_PATH)
+    SET(exe "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/CMakeSetup.exe")
+  ENDIF(EXECUTABLE_OUTPUT_PATH)
+
+  # VERBATIM flag should be avoided if building with Visual Studio.
+  # (OK to add the flag if ${CMAKE_CFG_INTDIR} is "." which is one
+  # indicator that you are not building with Visual Studio.)
+  #
+  SET(verbatim_flag)
+  IF(NOT CMAKE_CONFIGURATION_TYPES)
+    # VERBATIM flag should also be avoided if using an older CMake.
+    # VERBATIM flag support was added in CMake 2.4.5
+    #
+    IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 2.4)
+      IF(${CMAKE_PATCH_VERSION} GREATER 4)
+        SET(verbatim_flag "VERBATIM")
+      ENDIF(${CMAKE_PATCH_VERSION} GREATER 4)
+    ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} EQUAL 2.4)
+
+    IF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)
+      SET(verbatim_flag "VERBATIM")
+    ENDIF(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4)
+
+    IF(NOT verbatim_flag)
+      MESSAGE("${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): warning
+        warning: The VERBATIM flag for ADD_CUSTOM_COMMAND may be required to execute mt correctly,
+                 but you are using a CMake ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} which does not parse the VERBATIM flag.
+                 Upgrade to CMake 2.4.5 or later to eliminate this warning.")
+    ENDIF(NOT verbatim_flag)
+  ENDIF(NOT CMAKE_CONFIGURATION_TYPES)
+
+  SET(_CMAKE_INPUT_RESOURCE "-inputresource:${exe};#1")
+  # if msvc71 then you can not replace the resource
+  # but you can add one, so set the input resource to empty
+  IF(MSVC71)
+    SET(_CMAKE_INPUT_RESOURCE )
+  ENDIF(MSVC71)
+  # Solve the "things named like *Setup prompt for admin privileges
+  # on Vista" problem by merging a manifest fragment that contains a
+  # requestedExecutionLevel element:
+  #
+  ADD_CUSTOM_COMMAND(TARGET CMakeSetup
+    POST_BUILD COMMAND mt
+    "${_CMAKE_INPUT_RESOURCE}"
+    -manifest "${CMAKE_CURRENT_SOURCE_DIR}/CMakeSetupManifest.xml"
+    "-outputresource:${exe};#1"
+    ${verbatim_flag}
+  )
+ENDIF(CMAKE_MT_EXECUTABLE)
+
 INSTALL_TARGETS(/bin CMakeSetup)
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 7443f08..5eeeec0 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -1461,14 +1461,7 @@
     }
   else
     {
-    if (this->Version == 8)
-      {
-      fout << "\tVersion=\"8.00\"\n";
-      }
-    else
-      {
-      fout << "\tVersion=\"7.00\"\n";
-      }
+    fout <<  "\tVersion=\"" << this->Version << ".00\"\n";
     }
   const char* projLabel = target.GetProperty("PROJECT_LABEL");
   if(!projLabel)
diff --git a/Source/cmLocalVisualStudioGenerator.cxx b/Source/cmLocalVisualStudioGenerator.cxx
index 796ea57..c4f3d36 100644
--- a/Source/cmLocalVisualStudioGenerator.cxx
+++ b/Source/cmLocalVisualStudioGenerator.cxx
@@ -126,6 +126,15 @@
     newline = newline_text;
     script += "cd ";
     script += this->Convert(workingDirectory, START_OUTPUT, SHELL);
+
+    // Change the working drive.
+    if(workingDirectory[0] && workingDirectory[1] == ':')
+      {
+      script += newline;
+      newline = newline_text;
+      script += workingDirectory[0];
+      script += workingDirectory[1];
+      }
     }
   // for visual studio IDE add extra stuff to the PATH
   // if CMAKE_MSVCIDE_RUN_PATH is set.