Skip to content

Commit

Permalink
fix: Copy ASAN dlls if CMake < 3.27
Browse files Browse the repository at this point in the history
  • Loading branch information
zchrissirhcz committed Dec 11, 2024
1 parent 18abd73 commit 8e2cc80
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/asan.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Author: Zhuo Zhang <[email protected]>
# Homepage: https://github.com/zchrissirhcz/rocbuild
# Last update: 2024-11-09 12:37:00
# Last update: 2024-12-12 00:14:00
cmake_minimum_required(VERSION 3.15)
include_guard()

Expand Down Expand Up @@ -61,16 +61,16 @@ if(ASAN_AVAILABLE)

# https://devblogs.microsoft.com/cppblog/msvc-address-sanitizer-one-dll-for-all-runtime-configurations/
if((CMAKE_C_COMPILER_VERSION STRGREATER_EQUAL 17.7) OR (CMAKE_CXX_COMPILER_VERSION STRGREATER_EQUAL 17.7))
if(CMAKE_GENERATOR MATCHES "Visual Studio") # for running/debugging in Visual Studio
cmake_minimum_required(VERSION 3.27)
if((CMAKE_GENERATOR MATCHES "Visual Studio") AND (CMAKE_VERSION VERSION_GREATER_EQUAL "3.27")) # for running/debugging in Visual Studio
if(CMAKE_GENERATOR_PLATFORM MATCHES "x64")
set(CMAKE_VS_DEBUGGER_ENVIRONMENT "PATH=$(VC_ExecutablePath_x64);%PATH%\nASAN_SYMBOLIZER_PATH=$(VC_ExecutablePath_x64)")
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "Win32")
set(CMAKE_VS_DEBUGGER_ENVIRONMENT "PATH=$(VC_ExecutablePath_x86);%PATH%\nASAN_SYMBOLIZER_PATH=$(VC_ExecutablePath_x86)")
endif()
endif()

if((CMAKE_GENERATOR MATCHES "Ninja") OR COPY_ASAN_DLLS)
if((CMAKE_GENERATOR MATCHES "Ninja") OR COPY_ASAN_DLLS OR
((CMAKE_GENERATOR MATCHES "Visual Studio") AND (CMAKE_VERSION VERSION_LESS "3.27")) )
get_filename_component(COMPILER_DIR ${CMAKE_CXX_COMPILER} DIRECTORY)
file(GLOB ASAN_DLLS "${COMPILER_DIR}/clang_rt.asan_dynamic*.dll")
foreach(ASAN_DLL ${ASAN_DLLS})
Expand Down

0 comments on commit 8e2cc80

Please sign in to comment.