Skip to content

Commit 9f19731

Browse files
author
Julian LALU
committed
Fix MSVC sanitizer
1 parent d399dc0 commit 9f19731

File tree

3 files changed

+797
-793
lines changed

3 files changed

+797
-793
lines changed

.github/workflows/sanitizer_msvc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
with:
1616
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
1717
- name: Generate visual Studio solution
18-
run: cmake.exe --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Btarget -G "Visual Studio 17 2022" -T host=x64 -A x64 #-DSANITIZER:BOOL=ON
18+
run: cmake.exe --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -Btarget -G "Visual Studio 17 2022" -T host=x64 -A x64 -DSANITIZER:BOOL=ON
1919
- name: Build
2020
run: cmake.exe --build target --config Debug
2121
- name: Test

sanitizer.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ function(enable_sanitizer project_name lib_name)
1414
# Disable <vector> ASAN Linker verification
1515
# https://learn.microsoft.com/en-us/answers/questions/864574/enabling-address-sanitizer-results-in-error-lnk203
1616
target_compile_definitions(${project_name} PRIVATE _DISABLE_VECTOR_ANNOTATION)
17+
target_compile_definitions(${project_name} PRIVATE _DISABLE_STRING_ANNOTATION)
18+
19+
# Disable incremental (warning LNK4300)
20+
set_target_properties(${project_name} PROPERTIES LINK_FLAGS "/INCREMENTAL:NO")
1721

1822
add_custom_command(TARGET ${project_name} POST_BUILD
1923
COMMAND Echo "Copy ${CMAKE_CXX_COMPILER_PATH}/clang_rt.asan_dbg_dynamic-x86_64.dll to $<TARGET_FILE_DIR:${project_name}>"

0 commit comments

Comments
 (0)