diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 87fe048ac..06d12f1d1 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -542,15 +542,14 @@ void cmLocalVisualStudio7Generator::FillFlagMapFromCommandFlags( std::string replace; while(flagTable->IDEName) { - if(flags.find(flagTable->commandFlag) != flags.npos) + std::string regex = "((/|-)"; + regex += flagTable->commandFlag; + regex += ")"; + cmsys::RegularExpression reg(regex.c_str()); + while(reg.find(flags)) { - // replace -flag - replace = "-"; - replace += flagTable->commandFlag; - cmSystemTools::ReplaceString(flags, replace.c_str(), ""); - // now replace /flag - replace[0] = '/'; - cmSystemTools::ReplaceString(flags, replace.c_str(), ""); + // replace the flag + cmSystemTools::ReplaceString(flags, reg.match(1).c_str(), ""); // now put value into flag map flagMap[flagTable->IDEName] = flagTable->value; } @@ -559,6 +558,7 @@ void cmLocalVisualStudio7Generator::FillFlagMapFromCommandFlags( } + void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, const char* configName, const char *libName,