[Build]Enable Control Flow Guard; required for MS binaries (#28910)

* Enable Control Flow Guard; it is a requirement for any MS binaries

As it says on the tin. Go go gadget VC!

* Disable CFG for CLR projects (boo)

* Disable E&C...

(cherry picked from commit f0c3f58468c2b5d5eb7ebd37e60b82e6f14fc5e8)

* okay, stop being surgical and just whack it

* Revert "okay, stop being surgical and just whack it"

This reverts commit e4e10c6b8ae0a5b407bb9d3d11b34b82a14934ed.

* Oh CLRSupport is a **property**
This commit is contained in:
Dustin L. Howett 2023-10-04 09:40:01 -05:00 committed by GitHub
parent a92443bdbf
commit 4eeba2629c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,6 +42,9 @@
<PreferredToolArchitecture Condition="'$(PROCESSOR_ARCHITECTURE)' == 'ARM64' or '$(PROCESSOR_ARCHITEW6432)' == 'ARM64'">arm64</PreferredToolArchitecture>
<VcpkgEnabled>false</VcpkgEnabled>
<ExternalIncludePath>$(MSBuildThisFileFullPath)\..\deps\;$(MSBuildThisFileFullPath)\..\packages\;$(ExternalIncludePath)</ExternalIncludePath>
<!-- Enable control flow guard for C++ projects that don't consume any C++ files -->
<!-- This covers the case where a .dll exports a .lib, but doesn't have any ClCompile entries. -->
<LinkControlFlowGuard>Guard</LinkControlFlowGuard>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
@ -56,6 +59,9 @@
<BuildStlModules>false</BuildStlModules>
<AdditionalOptions>/await %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!-- CLR + CFG are not compatible >:{ -->
<ControlFlowGuard Condition="'$(CLRSupport)' == ''">Guard</ControlFlowGuard>
<DebugInformationFormat Condition="'%(ControlFlowGuard)' == 'Guard'">ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>