Why not just write your own batch ('buildit.bat') file that does: call vcvarsall.bat nmake (or whatever the command to build in the VS command prompt is...) And then your command to build is: C:/full/path/to/buildit.bat It's presumably in a Windows-specific chunk of your CMakeLists anyway, so that should work fairly simply. HTH, David C.