diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-01-12 02:02:47 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-01-12 02:02:47 (GMT) |
commit | cca67d7f8eec353a4dd46ee021090af1f6cf546f (patch) | |
tree | 7fba62609a81e8343c31e5455a49c832cd6f3d8d | |
parent | 266ce704d216735f6b03911ed7036d7abb716202 (diff) | |
download | CMake-cca67d7f8eec353a4dd46ee021090af1f6cf546f.zip CMake-cca67d7f8eec353a4dd46ee021090af1f6cf546f.tar.gz CMake-cca67d7f8eec353a4dd46ee021090af1f6cf546f.tar.bz2 |
BUG: fix for bug 4239, NODEFAULTLIB flag support in ide
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 52 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.h | 6 |
2 files changed, 47 insertions, 11 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index bf85145..66e4a74 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -366,6 +366,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = {"GenerateManifest", "MANIFEST", "enable manifest generation", "TRUE"}, {"LinkIncremental", "INCREMENTAL:NO", "link incremental", "1"}, {"LinkIncremental", "INCREMENTAL:YES", "link incremental", "2"}, + {"IgnoreDefaultLibraryNames", "NODEFAULTLIB:", "USER_VALUE", ""}, {0,0,0,0 } }; @@ -625,6 +626,36 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, this->OutputBuildTool(fout, configName, libName, target); fout << "\t\t</Configuration>\n"; } +void cmLocalVisualStudio7Generator::ReplaceFlagSetMap(std::string& flags, + cmVS7FlagTable* flagTable, + std::map<cmStdString, + cmStdString>& flagMap, + std::string& option, + std::string::size_type pos) +{ + std::string value = flagTable->value; + if(strcmp(flagTable->comment, "USER_VALUE") == 0) + { + std::string::size_type len = flags.find(" ", pos); + if(len != flags.npos) + { + len -= option.size(); + } + value = flags.substr(pos+option.size(), len); + std::string fullflag = option; + fullflag += value; + // remove everything + cmSystemTools::ReplaceString(flags, fullflag.c_str(), ""); + } + else + { + cmSystemTools::ReplaceString(flags, option.c_str(), ""); + } + // now put value into flag map + + flagMap[flagTable->IDEName] = value; +} + void cmLocalVisualStudio7Generator::FillFlagMapFromCommandFlags( std::map<cmStdString, cmStdString>& flagMap, @@ -639,21 +670,21 @@ void cmLocalVisualStudio7Generator::FillFlagMapFromCommandFlags( // first do the - version option = "-"; option += flagTable->commandFlag; - while(flags.find(option) != flags.npos) + std::string::size_type pos = flags.find(option); + while(pos != flags.npos) { - // replace the flag - cmSystemTools::ReplaceString(flags, option.c_str(), ""); - // now put value into flag map - flagMap[flagTable->IDEName] = flagTable->value; + this->ReplaceFlagSetMap(flags, flagTable, flagMap, + option, pos); + pos = flags.find(option); } // now do the / version option[0] = '/'; - while(flags.find(option) != flags.npos) + pos = flags.find(option); + while(pos != flags.npos) { - // replace the flag - cmSystemTools::ReplaceString(flags, option.c_str(), ""); - // now put value into flag map - flagMap[flagTable->IDEName] = flagTable->value; + this->ReplaceFlagSetMap(flags, flagTable, flagMap, + option, pos); + pos = flags.find(option); } // move to next flag flagTable++; @@ -737,7 +768,6 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, this->FillFlagMapFromCommandFlags (flagMap, &cmLocalVisualStudio7GeneratorLinkFlagTable[0], extraLinkOptions); - switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: diff --git a/Source/cmLocalVisualStudio7Generator.h b/Source/cmLocalVisualStudio7Generator.h index 48dce0c..a3c6f62 100644 --- a/Source/cmLocalVisualStudio7Generator.h +++ b/Source/cmLocalVisualStudio7Generator.h @@ -65,6 +65,12 @@ public: void SetPlatformName(const char* n) { this->PlatformName = n;} virtual void ConfigureFinalPass(); private: + void ReplaceFlagSetMap(std::string& flags, + cmVS7FlagTable* flagTable, + std::map<cmStdString, + cmStdString>& flagMap, + std::string& option, + std::string::size_type pos); void FillFlagMapFromCommandFlags(std::map<cmStdString, cmStdString>& flagMap, cmVS7FlagTable* flagTable, |