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`.
This commit is contained in:
parent
313e966702
commit
35a6cac2d3
|
@ -276,6 +276,7 @@ Properties on Targets
|
||||||
/prop_tgt/VS_SCC_LOCALPATH
|
/prop_tgt/VS_SCC_LOCALPATH
|
||||||
/prop_tgt/VS_SCC_PROJECTNAME
|
/prop_tgt/VS_SCC_PROJECTNAME
|
||||||
/prop_tgt/VS_SCC_PROVIDER
|
/prop_tgt/VS_SCC_PROVIDER
|
||||||
|
/prop_tgt/VS_SDK_REFERENCES
|
||||||
/prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
|
/prop_tgt/VS_WINDOWS_TARGET_PLATFORM_MIN_VERSION
|
||||||
/prop_tgt/VS_WINRT_COMPONENT
|
/prop_tgt/VS_WINRT_COMPONENT
|
||||||
/prop_tgt/VS_WINRT_EXTENSIONS
|
/prop_tgt/VS_WINRT_EXTENSIONS
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
VS_SDK_REFERENCES
|
||||||
|
-----------------
|
||||||
|
|
||||||
|
Visual Studio project SDK references.
|
||||||
|
Specify a :ref:`;-list <CMake Language Lists>` of SDK references
|
||||||
|
to be added to a generated Visual Studio project, e.g.
|
||||||
|
``Microsoft.AdMediatorWindows81, Version=1.0``.
|
|
@ -0,0 +1,5 @@
|
||||||
|
vs-sdk-refs
|
||||||
|
-----------
|
||||||
|
|
||||||
|
* A :prop_tgt:`VS_SDK_REFERENCES` target property was added to tell
|
||||||
|
:ref:`Visual Studio Generators` to reference the named SDKs.
|
|
@ -2643,6 +2643,20 @@ void cmVisualStudio10TargetGenerator::WriteSinglePlatformExtension(
|
||||||
|
|
||||||
void cmVisualStudio10TargetGenerator::WriteSDKReferences()
|
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
|
// This only applies to Windows 10 apps
|
||||||
if (this->GlobalGenerator->TargetsWindowsStore() &&
|
if (this->GlobalGenerator->TargetsWindowsStore() &&
|
||||||
cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0")) {
|
cmHasLiteralPrefix(this->GlobalGenerator->GetSystemVersion(), "10.0")) {
|
||||||
|
@ -2655,7 +2669,10 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences()
|
||||||
|
|
||||||
if (desktopExtensionsVersion || mobileExtensionsVersion ||
|
if (desktopExtensionsVersion || mobileExtensionsVersion ||
|
||||||
iotExtensionsVersion) {
|
iotExtensionsVersion) {
|
||||||
|
if (!hasWrittenItemGroup) {
|
||||||
this->WriteString("<ItemGroup>\n", 1);
|
this->WriteString("<ItemGroup>\n", 1);
|
||||||
|
hasWrittenItemGroup = true;
|
||||||
|
}
|
||||||
if (desktopExtensionsVersion) {
|
if (desktopExtensionsVersion) {
|
||||||
this->WriteSingleSDKReference("WindowsDesktop",
|
this->WriteSingleSDKReference("WindowsDesktop",
|
||||||
desktopExtensionsVersion);
|
desktopExtensionsVersion);
|
||||||
|
@ -2667,6 +2684,9 @@ void cmVisualStudio10TargetGenerator::WriteSDKReferences()
|
||||||
if (iotExtensionsVersion) {
|
if (iotExtensionsVersion) {
|
||||||
this->WriteSingleSDKReference("WindowsIoT", iotExtensionsVersion);
|
this->WriteSingleSDKReference("WindowsIoT", iotExtensionsVersion);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hasWrittenItemGroup) {
|
||||||
this->WriteString("</ItemGroup>\n", 1);
|
this->WriteString("</ItemGroup>\n", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -134,6 +134,9 @@ if("${SHORT_VERSION}" STREQUAL "10.0")
|
||||||
set_property(TARGET ${EXE_NAME} PROPERTY VS_DESKTOP_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
set_property(TARGET ${EXE_NAME} PROPERTY VS_DESKTOP_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
||||||
set_property(TARGET ${EXE_NAME} PROPERTY VS_MOBILE_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
set_property(TARGET ${EXE_NAME} PROPERTY VS_MOBILE_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
||||||
set_property(TARGET ${EXE_NAME} PROPERTY VS_IOT_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
set_property(TARGET ${EXE_NAME} PROPERTY VS_IOT_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
||||||
|
|
||||||
|
# Add a reference to an SDK
|
||||||
|
set_property(TARGET ${EXE_NAME} PROPERTY VS_SDK_REFERENCES "Microsoft.UniversalCRT.Debug, Version=${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue