diff options
author | David Cole <david.cole@kitware.com> | 2011-07-29 14:04:36 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2011-07-29 14:04:36 (GMT) |
commit | df9577259ca5a30f5c79baee038fe42e25b4a1e5 (patch) | |
tree | e535fcee5353e59e2e1bd57a8bff809ed569dee9 /Source/cmLocalVisualStudio7Generator.cxx | |
parent | b6fb213ed1431321fab0705beb3aae82f451dcc8 (diff) | |
download | CMake-df9577259ca5a30f5c79baee038fe42e25b4a1e5.zip CMake-df9577259ca5a30f5c79baee038fe42e25b4a1e5.tar.gz CMake-df9577259ca5a30f5c79baee038fe42e25b4a1e5.tar.bz2 |
Add support for Visual Studio project-specific globals (#8707)
Thanks to Pau Garcia i Quiles for the inspiration for the patch.
I've tweaked it a bit compared to what's in the bug tracker: this
commit does not allow empty global variable names.
I also added usage of the new feature to an existing test. Although
it has no effect on the resulting Visual Studio projects, you can
verify that the VSResource test produces a non-empty globals section
in the generated .vcproj(x) files.
Diffstat (limited to 'Source/cmLocalVisualStudio7Generator.cxx')
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 7a62b9c..3e76f59 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1279,7 +1279,7 @@ void cmLocalVisualStudio7Generator::WriteVCProjFile(std::ostream& fout, fout << "\t</Files>\n"; // Write the VCProj file's footer. - this->WriteVCProjFooter(fout); + this->WriteVCProjFooter(fout, target); } struct cmLVS7GFileConfig @@ -1880,10 +1880,28 @@ cmLocalVisualStudio7Generator::WriteProjectStart(std::ostream& fout, } -void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout) +void cmLocalVisualStudio7Generator::WriteVCProjFooter(std::ostream& fout, + cmTarget &target) { - fout << "\t<Globals>\n" - << "\t</Globals>\n" + fout << "\t<Globals>\n"; + + cmPropertyMap const& props = target.GetProperties(); + for(cmPropertyMap::const_iterator i = props.begin(); i != props.end(); ++i) + { + if(i->first.find("VS_GLOBAL_") == 0) + { + std::string name = i->first.substr(10); + if(name != "") + { + fout << "\t\t<Global\n" + << "\t\t\tName=\"" << name << "\"\n" + << "\t\t\tValue=\"" << i->second.GetValue() << "\"\n" + << "\t\t/>\n"; + } + } + } + + fout << "\t</Globals>\n" << "</VisualStudioProject>\n"; } |