summaryrefslogtreecommitdiffstats
path: root/Source/cmVisualStudio10TargetGenerator.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-07-29 18:03:35 (GMT)
committerBrad King <brad.king@kitware.com>2014-08-12 14:08:47 (GMT)
commit9b4dc2ad4a82b233520015fdc5cbf5df1ed540f7 (patch)
treee443202093fd79ef3abcaa967cf894780111ea38 /Source/cmVisualStudio10TargetGenerator.cxx
parentf063a914c649b1dfbcd1a02d381b4e94ad01ceaa (diff)
downloadCMake-9b4dc2ad4a82b233520015fdc5cbf5df1ed540f7.zip
CMake-9b4dc2ad4a82b233520015fdc5cbf5df1ed540f7.tar.gz
CMake-9b4dc2ad4a82b233520015fdc5cbf5df1ed540f7.tar.bz2
VS: Add a source file property to mark content for Windows App deployment
Create a VS_DEPLOYMENT_CONTENT source file property, supporting generator expressions, to compute whether a source file should be marked as DeploymentContent or ExcludedFromBuild in Windows Phone and Windows Store projects. Inspired-by: Minmin Gong <minmin.gong@gmail.com>
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 3dadd52..01a3b37 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1035,10 +1035,50 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
tool = "XML";
}
+ std::string deployContent;
+ if(this->GlobalGenerator->TargetsWindowsPhone() ||
+ this->GlobalGenerator->TargetsWindowsStore())
+ {
+ const char* content = sf->GetProperty("VS_DEPLOYMENT_CONTENT");
+ if(content && *content)
+ {
+ toolHasSettings = true;
+ deployContent = content;
+ }
+ }
+
if(toolHasSettings)
{
this->WriteSource(tool, sf, ">\n");
+ if(!deployContent.empty())
+ {
+ std::vector<std::string> const* configs =
+ this->GlobalGenerator->GetConfigurations();
+ cmGeneratorExpression ge;
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(deployContent);
+ for(size_t i = 0; i != configs->size(); ++i)
+ {
+ if(0 == strcmp(cge->Evaluate(this->Makefile, (*configs)[i]), "1"))
+ {
+ this->WriteString("<DeploymentContent Condition=\""
+ "'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|"
+ << this->Platform << "'\">true";
+ this->WriteString("</DeploymentContent>\n", 0);
+ }
+ else
+ {
+ this->WriteString("<ExcludedFromBuild Condition=\""
+ "'$(Configuration)|$(Platform)'=='", 3);
+ (*this->BuildFileStream) << (*configs)[i] << "|"
+ << this->Platform << "'\">true";
+ this->WriteString("</ExcludedFromBuild>\n", 0);
+ }
+ }
+ }
+
this->WriteString("</", 2);
(*this->BuildFileStream) << tool << ">\n";
}