Skip to content

Commit 032effe

Browse files
authored
Enable /await opt-out so users can manually enable /await:strict. (#1015)
* Switch to using /await:strict which is binary compatible with c++20 coroutines. * Make legacy coroutines opt-in.
1 parent 3aa0339 commit 032effe

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

nuget/CppWinrtRules.Project.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,9 @@
8181
Description="Enables or disables the default for copying binaries to the output folder to be false"
8282
Category="General" />
8383

84+
<BoolProperty Name="CppWinRTEnableLegacyCoroutines"
85+
DisplayName="Enable legacy coroutines (C++17)"
86+
Description="Enables the /await compiler option (disable this if you want to pass this yourself)"
87+
Category="General" />
88+
8489
</Rule>

nuget/Microsoft.Windows.CppWinRT.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ $(XamlMetaDataProviderPch)
871871
<ItemDefinitionGroup>
872872
<ClCompile>
873873
<AdditionalOptions>%(AdditionalOptions) /bigobj</AdditionalOptions>
874-
<AdditionalOptions Condition="'%(ClCompile.LanguageStandard)' == 'stdcpp17'">%(AdditionalOptions) /await</AdditionalOptions>
874+
<AdditionalOptions Condition="'%(ClCompile.LanguageStandard)' == 'stdcpp17' And '$(CppWinRTEnableLegacyCoroutines)' != 'false'">%(AdditionalOptions) /await</AdditionalOptions>
875875
<AdditionalIncludeDirectories>%(AdditionalIncludeDirectories);$(GeneratedFilesDir)</AdditionalIncludeDirectories>
876876
</ClCompile>
877877
<Midl Condition="'$(CppWinRTModernIDL)' != 'false'">

0 commit comments

Comments
 (0)