diff options
author | Gilles Khouzam <gillesk@microsoft.com> | 2016-06-17 21:18:39 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-06-22 12:34:12 (GMT) |
commit | 35a6cac2d3bf550edf5306e6270a80fc848deeb8 (patch) | |
tree | 17f4ef680e688d4017b1e179e0e967d8ef694885 /Source/cmVisualStudio10TargetGenerator.cxx | |
parent | 313e9667021a510151117d8222e958174b691261 (diff) | |
download | CMake-35a6cac2d3bf550edf5306e6270a80fc848deeb8.zip CMake-35a6cac2d3bf550edf5306e6270a80fc848deeb8.tar.gz CMake-35a6cac2d3bf550edf5306e6270a80fc848deeb8.tar.bz2 |
VS: Add VS_SDK_REFERENCES target property to reference external SDKs
Allow one to specify external SDK references such as
`Microsoft.AdMediatorWindows81, Version=1.0`.
Diffstat (limited to 'Source/cmVisualStudio10TargetGenerator.cxx')
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 3b1cddb..6ab32bf 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2643,6 +2643,20 @@ void cmVisualStudio10TargetGenerator::WriteSinglePlatformExtension( void cmVisualStudio10TargetGenerator::WriteSDKReferences() { + std::vector<std::string> sdkReferences; + bool hasWrittenItemGroup = false; + if (const char* vsSDKReferences = + this->GeneratorTarget->GetProperty("VS_SDK_REFERENCES")) { + cmSystemTools::ExpandListArgument(vsSDKReferences, sdkReferences); + this->WriteString("<ItemGroup>\n", 1); + hasWrittenItemGroup = true; + for (std::vector<std::string>::iterator ri = sdkReferences.begin(); + ri != sdkReferences.end(); ++ri) { + this->WriteString("<SDKReference Include=\"", 2); + (*this->BuildFileStream) << cmVS10EscapeXML(*ri) << "\"/>\n"; + } + } + // This only applies to Windows 10 apps if (this->GlobalGenerator->TargetsWindowsStore() && cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0")) { @@ -2655,7 +2669,10 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences() if (desktopExtensionsVersion || mobileExtensionsVersion || iotExtensionsVersion) { - this->WriteString("<ItemGroup>\n", 1); + if (!hasWrittenItemGroup) { + this->WriteString("<ItemGroup>\n", 1); + hasWrittenItemGroup = true; + } if (desktopExtensionsVersion) { this->WriteSingleSDKReference("WindowsDesktop", desktopExtensionsVersion); @@ -2667,6 +2684,9 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences() if (iotExtensionsVersion) { this->WriteSingleSDKReference("WindowsIoT", iotExtensionsVersion); } + } + + if (hasWrittenItemGroup) { this->WriteString("</ItemGroup>\n", 1); } } |