MantisBT - CMake
View Issue Details
0006234CMakeCMakepublic2008-01-11 07:442008-01-15 14:09
bullestock 
Brad King 
normalminoralways
closedfixed 
 
 
0006234: Visual Studio: No support for building on different drive
When the build directory is located on another drive than the source directory, custom build steps can fail because the generated .vcproj files issue only a 'cd' command, which does not change the drive. The fix is simple: Add a /d to the cd command (alas, this does not work for Windows versions below W2K).

See patch against 2.4.7 below.
--- c:/user/tma/cmake-2.4.7/Source.orig/cmLocalVisualStudioGenerator.cxx Mon Jul 16 17:16:44 2007
+++ c:/user/tma/cmake-2.4.7/Source/cmLocalVisualStudioGenerator.cxx Thu Jan 10 09:00:29 2008
@@ -20,6 +20,8 @@
 #include "cmSourceFile.h"
 #include "cmSystemTools.h"
 
+#include <windows.h>
+
 //----------------------------------------------------------------------------
 cmLocalVisualStudioGenerator::cmLocalVisualStudioGenerator()
 {
@@ -125,6 +127,13 @@
     script += newline;
     newline = newline_text;
     script += "cd ";
+ OSVERSIONINFO osv;
+ osv.dwOSVersionInfoSize = sizeof(osv);
+ GetVersionEx(&osv);
+ if(osv.dwPlatformId != VER_PLATFORM_WIN32_WINDOWS)
+ {
+ script += "/d ";
+ }
     script += this->Convert(workingDirectory, START_OUTPUT, SHELL);
     }
   // for visual studio IDE add extra stuff to the PATH

No tags attached.
duplicate of 0006150closed Brad King WORKING_DIRECTORY in ADD_CUSTOM_COMMAND fails when the directory is on a different drive. (VS2005) 
Issue History
2008-01-11 07:44bullestockNew Issue
2008-01-15 11:57Bill HoffmanNote Added: 0010152
2008-01-15 11:57Bill HoffmanStatusnew => closed
2008-01-15 11:57Bill HoffmanResolutionopen => fixed
2008-01-15 14:07Brad KingAssigned To => Brad King
2008-01-15 14:07Brad KingStatusclosed => feedback
2008-01-15 14:07Brad KingResolutionfixed => reopened
2008-01-15 14:07Brad KingNote Added: 0010153
2008-01-15 14:08Brad KingRelationship addedduplicate of 0006150
2008-01-15 14:09Brad KingStatusfeedback => closed
2008-01-15 14:09Brad KingNote Added: 0010154
2008-01-15 14:09Brad KingResolutionreopened => fixed

Notes
(0010152)
Bill Hoffman   
2008-01-15 11:57   
Thanks, done:

$ cvs commit -m "BUG: fix for bug 6234, use cd /d so that drives can be changed. " cmLocalVisualStudioGenerator.cxx
/cvsroot/CMake/CMake/Source/cmLocalVisualStudioGenerator.cxx,v <-- cmLocalVisualStudioGenerator.cxx
new revision: 1.15; previous revision: 1.14
(0010153)
Brad King   
2008-01-15 14:07   
I'm re-opening this to add a relationship to a duplicate bug.
(0010154)
Brad King   
2008-01-15 14:09   
The patch Bill committed has been removed. The fix to bug 6150 works on all windows versions and was already committed.