From 329b1ef82275acc164d17675c44b5e810b32afc6 Mon Sep 17 00:00:00 2001
From: Robert Goulet <robert.goulet@autodesk.com>
Date: Mon, 26 Jan 2015 14:16:42 -0500
Subject: [PATCH] Add VS_SHADER_FLAGS source file property so that we can set
 all other Visual Studio .hlsl shader file compilation flags.

---
 Source/cmVisualStudio10TargetGenerator.cxx | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index b265c0e..2ce1c38 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1211,6 +1211,7 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
   std::string shaderType;
   std::string shaderEntryPoint;
   std::string shaderModel;
+  std::string shaderAdditionalFlags;
   std::string ext = cmSystemTools::LowerCase(sf->GetExtension());
   if(ext == "hlsl")
     {
@@ -1233,6 +1234,11 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
       shaderModel = sm;
       toolHasSettings = true;
       }
+	if (const char* saf = sf->GetProperty("VS_SHADER_FLAGS"))
+	  {
+	  shaderAdditionalFlags = saf;
+	  toolHasSettings = true;
+	  }
     }
   else if(ext == "jpg" ||
           ext == "png")
@@ -1342,6 +1348,12 @@ void cmVisualStudio10TargetGenerator::WriteExtraSource(cmSourceFile const* sf)
       (*this->BuildFileStream) << cmVS10EscapeXML(shaderModel)
                                << "</ShaderModel>\n";
       }
+	if(!shaderAdditionalFlags.empty())
+      {
+      this->WriteString("<AdditionalOptions>", 3);
+      (*this->BuildFileStream) << cmVS10EscapeXML(shaderAdditionalFlags)
+                               << "</AdditionalOptions>\n";
+      }
     this->WriteString("</", 2);
     (*this->BuildFileStream) << tool << ">\n";
     }
-- 
1.9.4.msysgit.0

