diff options
Diffstat (limited to 'Source/cmGlobalVisualStudio6Generator.cxx')
-rw-r--r-- | Source/cmGlobalVisualStudio6Generator.cxx | 106 |
1 files changed, 52 insertions, 54 deletions
diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index 4006df4..8651da7 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -32,7 +32,7 @@ std::string GetVS6TargetName(const std::string& targetName) cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator() { - this->FindMakeProgramFile = "CMakeVS6FindMake.cmake"; + this->MSDevCommandInitialized = false; } void cmGlobalVisualStudio6Generator @@ -77,52 +77,53 @@ void cmGlobalVisualStudio6Generator::GenerateConfigurations(cmMakefile* mf) } } -std::string cmGlobalVisualStudio6Generator -::GenerateBuildCommand(const char* makeProgram, - const char *projectName, - const char *projectDir, - const char* additionalOptions, - const char *targetName, - const char* config, - bool ignoreErrors, - bool) +//---------------------------------------------------------------------------- +std::string const& cmGlobalVisualStudio6Generator::GetMSDevCommand() { - // Visual studio 6 doesn't need project dir - (void) projectDir; - // Ingoring errors is not implemented in visual studio 6 - (void) ignoreErrors; - - // now build the test - std::vector<std::string> mp; - mp.push_back("[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio" - "\\6.0\\Setup;VsCommonDir]/MSDev98/Bin"); - cmSystemTools::ExpandRegistryValues(mp[0]); - std::string originalCommand = makeProgram; - std::string makeCommand = - cmSystemTools::FindProgram(makeProgram, mp); - if(makeCommand.size() == 0) + if(!this->MSDevCommandInitialized) { - std::string e = "Generator cannot find Visual Studio 6 msdev program \""; - e += originalCommand; - e += "\" specified by CMAKE_MAKE_PROGRAM cache entry. "; - e += "Please fix the setting."; - cmSystemTools::Error(e.c_str()); - return ""; + this->MSDevCommandInitialized = true; + this->MSDevCommand = this->FindMSDevCommand(); } - makeCommand = cmSystemTools::ConvertToOutputPath(makeCommand.c_str()); + return this->MSDevCommand; +} - // if there are spaces in the makeCommand, assume a full path - // and convert it to a path with no spaces in it as the - // RunSingleCommand does not like spaces -#if defined(_WIN32) && !defined(__CYGWIN__) - if(makeCommand.find(' ') != std::string::npos) +//---------------------------------------------------------------------------- +std::string cmGlobalVisualStudio6Generator::FindMSDevCommand() +{ + std::string vscmd; + std::string vskey = this->GetRegistryBase() + "\\Setup;VsCommonDir"; + if(cmSystemTools::ReadRegistryValue(vskey.c_str(), vscmd, + cmSystemTools::KeyWOW64_32)) { - cmSystemTools::GetShortPath(makeCommand.c_str(), makeCommand); + cmSystemTools::ConvertToUnixSlashes(vscmd); + vscmd += "/MSDev98/Bin/"; } -#endif - makeCommand += " "; - makeCommand += projectName; - makeCommand += ".dsw /MAKE \""; + vscmd += "msdev.exe"; + return vscmd; +} + +//---------------------------------------------------------------------------- +void +cmGlobalVisualStudio6Generator::GenerateBuildCommand( + std::vector<std::string>& makeCommand, + const char* makeProgram, + const char* projectName, + const char* /*projectDir*/, + const char* targetName, + const char* config, + bool /*fast*/, + std::vector<std::string> const& makeOptions + ) +{ + // now build the test + makeCommand.push_back( + this->SelectMakeProgram(makeProgram, this->GetMSDevCommand()) + ); + + makeCommand.push_back(std::string(projectName)+".dsw"); + makeCommand.push_back("/MAKE"); + std::string targetArg; bool clean = false; if ( targetName && strcmp(targetName, "clean") == 0 ) { @@ -131,35 +132,32 @@ std::string cmGlobalVisualStudio6Generator } if (targetName && strlen(targetName)) { - makeCommand += targetName; + targetArg += targetName; } else { - makeCommand += "ALL_BUILD"; + targetArg += "ALL_BUILD"; } - makeCommand += " - "; + targetArg += " - "; if(config && strlen(config)) { - makeCommand += config; + targetArg += config; } else { - makeCommand += "Debug"; + targetArg += "Debug"; } + makeCommand.push_back(targetArg); if(clean) { - makeCommand += "\" /CLEAN"; + makeCommand.push_back("/CLEAN"); } else { - makeCommand += "\" /BUILD"; - } - if ( additionalOptions ) - { - makeCommand += " "; - makeCommand += additionalOptions; + makeCommand.push_back("/BUILD"); } - return makeCommand; + makeCommand.insert(makeCommand.end(), + makeOptions.begin(), makeOptions.end()); } ///! Create a local generator appropriate to this Global Generator |