diff options
Diffstat (limited to 'Source/cmVisualStudioGeneratorOptions.cxx')
-rw-r--r-- | Source/cmVisualStudioGeneratorOptions.cxx | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/Source/cmVisualStudioGeneratorOptions.cxx b/Source/cmVisualStudioGeneratorOptions.cxx index 6aca787..cdc8879 100644 --- a/Source/cmVisualStudioGeneratorOptions.cxx +++ b/Source/cmVisualStudioGeneratorOptions.cxx @@ -3,9 +3,9 @@ #include <cmsys/System.h> #include "cmVisualStudio10TargetGenerator.h" -inline std::string cmVisualStudio10GeneratorOptionsEscapeForXML(const char* s) +static +std::string cmVisualStudio10GeneratorOptionsEscapeForXML(std::string ret) { - std::string ret = s; cmSystemTools::ReplaceString(ret, ";", "%3B"); cmSystemTools::ReplaceString(ret, "&", "&"); cmSystemTools::ReplaceString(ret, "<", "<"); @@ -13,9 +13,9 @@ inline std::string cmVisualStudio10GeneratorOptionsEscapeForXML(const char* s) return ret; } -inline std::string cmVisualStudioGeneratorOptionsEscapeForXML(const char* s) +static +std::string cmVisualStudioGeneratorOptionsEscapeForXML(std::string ret) { - std::string ret = s; cmSystemTools::ReplaceString(ret, "&", "&"); cmSystemTools::ReplaceString(ret, "\"", """); cmSystemTools::ReplaceString(ret, "<", "<"); @@ -68,6 +68,7 @@ void cmVisualStudioGeneratorOptions::FixExceptionHandlingDefault() case cmLocalVisualStudioGenerator::VS10: case cmLocalVisualStudioGenerator::VS11: case cmLocalVisualStudioGenerator::VS12: + case cmLocalVisualStudioGenerator::VS14: // by default VS puts <ExceptionHandling></ExceptionHandling> empty // for a project, to make our projects look the same put a new line // and space over for the closing </ExceptionHandling> as the default @@ -106,6 +107,12 @@ bool cmVisualStudioGeneratorOptions::IsDebug() const } //---------------------------------------------------------------------------- +bool cmVisualStudioGeneratorOptions::IsWinRt() const +{ + return this->FlagMap.find("CompileAsWinRT") != this->FlagMap.end(); +} + +//---------------------------------------------------------------------------- bool cmVisualStudioGeneratorOptions::UsingUnicode() const { // Look for the a _UNICODE definition. @@ -222,7 +229,7 @@ cmVisualStudioGeneratorOptions ::OutputPreprocessorDefinitions(std::ostream& fout, const char* prefix, const char* suffix, - const char* lang) + const std::string& lang) { if(this->Defines.empty()) { @@ -268,16 +275,16 @@ cmVisualStudioGeneratorOptions // Escape this flag for the IDE. if(this->Version >= cmLocalVisualStudioGenerator::VS10) { - define = cmVisualStudio10GeneratorOptionsEscapeForXML(define.c_str()); + define = cmVisualStudio10GeneratorOptionsEscapeForXML(define); - if(0 == strcmp(lang, "RC")) + if(lang == "RC") { cmSystemTools::ReplaceString(define, "\"", "\\\""); } } else { - define = cmVisualStudioGeneratorOptionsEscapeForXML(define.c_str()); + define = cmVisualStudioGeneratorOptionsEscapeForXML(define); } // Store the flag in the project file. fout << sep << define; @@ -300,7 +307,7 @@ cmVisualStudioGeneratorOptions { if(this->Version >= cmLocalVisualStudioGenerator::VS10) { - for(std::map<cmStdString, cmStdString>::iterator m = this->FlagMap.begin(); + for(std::map<std::string, FlagValue>::iterator m = this->FlagMap.begin(); m != this->FlagMap.end(); ++m) { fout << indent; @@ -316,20 +323,30 @@ cmVisualStudioGeneratorOptions { fout << "<" << m->first << ">"; } - fout << m->second; - if (m->first == "AdditionalIncludeDirectories") + const char* sep = ""; + for(std::vector<std::string>::iterator i = m->second.begin(); + i != m->second.end(); ++i) { - fout << ";%(AdditionalIncludeDirectories)"; + fout << sep << cmVisualStudio10GeneratorOptionsEscapeForXML(*i); + sep = ";"; } fout << "</" << m->first << ">\n"; } } else { - for(std::map<cmStdString, cmStdString>::iterator m = this->FlagMap.begin(); + for(std::map<std::string, FlagValue>::iterator m = this->FlagMap.begin(); m != this->FlagMap.end(); ++m) { - fout << indent << m->first << "=\"" << m->second << "\"\n"; + fout << indent << m->first << "=\""; + const char* sep = ""; + for(std::vector<std::string>::iterator i = m->second.begin(); + i != m->second.end(); ++i) + { + fout << sep << cmVisualStudioGeneratorOptionsEscapeForXML(*i); + sep = ";"; + } + fout << "\"\n"; } } } @@ -358,14 +375,13 @@ cmVisualStudioGeneratorOptions { fout << "<AdditionalOptions>"; } - fout << this->FlagString.c_str() + fout << cmVisualStudio10GeneratorOptionsEscapeForXML(this->FlagString) << " %(AdditionalOptions)</AdditionalOptions>\n"; } else { fout << prefix << "AdditionalOptions=\""; - fout << - cmVisualStudioGeneratorOptionsEscapeForXML(this->FlagString.c_str()); + fout << cmVisualStudioGeneratorOptionsEscapeForXML(this->FlagString); fout << "\"" << suffix; } } |