mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
VS: Fix WinRT component references
WinRT components need to be referenced in a similar way that managed code libraries are referenced. Validate that the library reference is a WinRT component and reference it through the project. Add test coverage for `VS_WINRT_COMPONENT`. While at it, fix the IOT reference failing on Win10 SDK 17763 which doesn't include it anymore. Fixes: #18846
This commit is contained in:
committed by
Brad King
parent
6c21722adb
commit
cff026dbc0
@@ -3884,8 +3884,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0)
|
||||
this->WriteDotNetReferenceCustomTags(e2, name);
|
||||
|
||||
// If the dependency target is not managed (compiled with /clr or
|
||||
// C# target) we cannot reference it and have to set
|
||||
// 'ReferenceOutputAssembly' to false.
|
||||
// C# target) and not a WinRT component we cannot reference it and
|
||||
// have to set 'ReferenceOutputAssembly' to false.
|
||||
auto referenceNotManaged =
|
||||
dt->GetManagedType("") < cmGeneratorTarget::ManagedType::Mixed;
|
||||
// Workaround to check for manually set /clr flags.
|
||||
@@ -3902,6 +3902,12 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences(Elem& e0)
|
||||
if (referenceNotManaged && dt->GetType() == cmStateEnums::STATIC_LIBRARY) {
|
||||
referenceNotManaged = !dt->IsCSharpOnly();
|
||||
}
|
||||
|
||||
// Referencing WinRT components is okay.
|
||||
if (referenceNotManaged) {
|
||||
referenceNotManaged = !dt->GetPropertyAsBool("VS_WINRT_COMPONENT");
|
||||
}
|
||||
|
||||
if (referenceNotManaged) {
|
||||
e2.Element("ReferenceOutputAssembly", "false");
|
||||
e2.Element("CopyToOutputDirectory", "Never");
|
||||
|
||||
Reference in New Issue
Block a user