From af39f11521af7fc2ec037103df1ad5a616dd7f19 Mon Sep 17 00:00:00 2001 From: Mike Fitzgerald Date: Fri, 8 Jan 2016 17:33:28 -0500 Subject: [PATCH] VS: Implement VS_GLOBAL_* target properties in VS 2010+ (#13666) These have been documented but previously only implemented for VS 2008 and below. --- Help/release/dev/vs-global-properties.rst | 5 +++++ Source/cmVisualStudio10TargetGenerator.cxx | 26 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Help/release/dev/vs-global-properties.rst diff --git a/Help/release/dev/vs-global-properties.rst b/Help/release/dev/vs-global-properties.rst new file mode 100644 index 000000000..cae49b742 --- /dev/null +++ b/Help/release/dev/vs-global-properties.rst @@ -0,0 +1,5 @@ +vs-global-properties +-------------------- + +* The :prop_tgt:`VS_GLOBAL_` target property is now implemented + for VS 2010 and above. Previously it worked only in VS 2008 and below. diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 669c78543..c9705aca4 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -448,6 +448,32 @@ void cmVisualStudio10TargetGenerator::Generate() (*this->BuildFileStream) << cmVS10EscapeXML(targetFrameworkVersion) << "\n"; } + + std::vector keys = this->GeneratorTarget->GetPropertyKeys(); + for(std::vector::const_iterator keyIt = keys.begin(); + keyIt != keys.end(); ++keyIt) + { + static const char* prefix = "VS_GLOBAL_"; + if(keyIt->find(prefix) != 0) + continue; + std::string globalKey = keyIt->substr(strlen(prefix)); + // Skip invalid or separately-handled properties. + if(globalKey == "" || + globalKey == "PROJECT_TYPES" || + globalKey == "ROOTNAMESPACE" || + globalKey == "KEYWORD") + { + continue; + } + const char* value = this->GeneratorTarget->GetProperty(keyIt->c_str()); + if (!value) + continue; + this->WriteString("<", 2); + (*this->BuildFileStream) << globalKey << ">" + << cmVS10EscapeXML(value) + << "\n"; + } + this->WriteString("\n", 1); this->WriteString("\n",