summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGilles Khouzam <gillesk@microsoft.com>2014-08-11 18:40:09 (GMT)
committerBrad King <brad.king@kitware.com>2014-08-21 13:28:20 (GMT)
commite6ff2f8bb4308b055b1f6b193b9cabb9f45c65ae (patch)
tree852576e2a2ec13c524bb2e76a6bf558040b86933
parentee48f4c7ae2c63fc565b1c112f887965b7c3b248 (diff)
downloadCMake-e6ff2f8bb4308b055b1f6b193b9cabb9f45c65ae.zip
CMake-e6ff2f8bb4308b055b1f6b193b9cabb9f45c65ae.tar.gz
CMake-e6ff2f8bb4308b055b1f6b193b9cabb9f45c65ae.tar.bz2
VS: Generate Windows Metadata for WinRT components
Inspired-by: Paul Annetts <paul@lightunobscured.com>
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 08daad4..9e9011d 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1774,6 +1774,18 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config)
libOptions.OutputFlagMap(*this->BuildFileStream, " ");
this->WriteString("</Lib>\n", 2);
}
+
+ // We cannot generate metadata for static libraries. WindowsPhone
+ // and WindowsStore tools look at GenerateWindowsMetadata in the
+ // Link tool options even for static libraries.
+ if(this->GlobalGenerator->TargetsWindowsPhone() ||
+ this->GlobalGenerator->TargetsWindowsStore())
+ {
+ this->WriteString("<Link>\n", 2);
+ this->WriteString("<GenerateWindowsMetadata>false"
+ "</GenerateWindowsMetadata>\n", 3);
+ this->WriteString("</Link>\n", 2);
+ }
}
//----------------------------------------------------------------------------
@@ -1955,6 +1967,21 @@ cmVisualStudio10TargetGenerator::ComputeLinkOptions(std::string const& config)
linkOptions.AddFlag("ImportLibrary", imLib.c_str());
linkOptions.AddFlag("ProgramDataBaseFile", pdb.c_str());
+
+ // A Windows Runtime component uses internal .NET metadata,
+ // so does not have an import library.
+ if(this->Target->GetPropertyAsBool("VS_WINRT_COMPONENT"))
+ {
+ linkOptions.AddFlag("GenerateWindowsMetadata", "true");
+ }
+ else if (this->GlobalGenerator->TargetsWindowsPhone() ||
+ this->GlobalGenerator->TargetsWindowsStore())
+ {
+ // WindowsPhone and WindowsStore components are in an app container
+ // and produce WindowsMetadata. If we are not producing a WINRT
+ // component, then do not generate the metadata here.
+ linkOptions.AddFlag("GenerateWindowsMetadata", "false");
+ }
}
linkOptions.Parse(flags.c_str());