﻿<!--
***********************************************************************************************
Microsoft.Cpp.EnableASAN.props

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <_PropertySheetDisplayName>Enable Address Sanitizer</_PropertySheetDisplayName>
    <!-- need to add VC exe path to allow ASan RT libs to be picked up when debugging -->
    
    <LocalDebuggerEnvironment Condition="'$(EnableASAN)' == 'true' and '$(LocalDebuggerEnvironment)' == '' and '$(PlatformTarget)' == 'x86' and '$(AsanOptions)' != ''">PATH=$(VC_ExecutablePath_x86);%PATH%
ASAN_SYMBOLIZER_PATH=$(VC_ExecutablePath_x86)
ASAN_OPTIONS=$(AsanOptions)
    </LocalDebuggerEnvironment>
    
    <LocalDebuggerEnvironment Condition="'$(EnableASAN)' == 'true' and '$(LocalDebuggerEnvironment)' == '' and '$(PlatformTarget)' == 'x86' and '$(AsanOptions)' == ''">PATH=$(VC_ExecutablePath_x86);%PATH%
ASAN_SYMBOLIZER_PATH=$(VC_ExecutablePath_x86)
    </LocalDebuggerEnvironment>


    <LocalDebuggerEnvironment Condition="'$(EnableASAN)' == 'true' and '$(LocalDebuggerEnvironment)' == '' and '$(PlatformTarget)' == 'x64' and '$(AsanOptions)' != ''">PATH=$(VC_ExecutablePath_x64);%PATH%
ASAN_SYMBOLIZER_PATH=$(VC_ExecutablePath_x64)
ASAN_OPTIONS=$(AsanOptions)
     </LocalDebuggerEnvironment>

    <LocalDebuggerEnvironment Condition="'$(EnableASAN)' == 'true' and '$(LocalDebuggerEnvironment)' == '' and '$(PlatformTarget)' == 'x64' and '$(AsanOptions)' == ''">PATH=$(VC_ExecutablePath_x64);%PATH%
ASAN_SYMBOLIZER_PATH=$(VC_ExecutablePath_x64)
    </LocalDebuggerEnvironment>


  </PropertyGroup>

  <PropertyGroup Condition="'$(EnableASAN)' == 'true' and '$(AppxPackage)' == 'true'">
    <!-- Packaged apps do not have access to the user PATH,so we need to copy the ASan dlls to the app's output directory -->
    <CopyAsanBinariesToOutDir>true</CopyAsanBinariesToOutDir>
  </PropertyGroup>

</Project>
