Skip to content

Commit 887ff63

Browse files
committed
Disable incremental linking in msvc when sanitizers are enabled.
1 parent e6c85d7 commit 887ff63

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

cmake/CompileOptions.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,17 @@ if(WIN32 AND MSVC)
235235
# Sanitizers
236236
if(OPTION_BUILD_THREAD_SANITIZER AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
237237
add_compile_options(/fsanitize=thread)
238+
add_link_options(/INCREMENTAL:NO)
238239
elseif(OPTION_BUILD_SANITIZER AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
239240
add_compile_options(/fsanitize=address)
241+
add_link_options(/INCREMENTAL:NO)
240242
elseif(OPTION_BUILD_MEMORY_SANITIZER AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
241243
add_compile_options(/fsanitize=memory)
242244
add_compile_options(/fsanitize=leak)
245+
add_link_options(/INCREMENTAL:NO)
243246
elseif(OPTION_BUILD_UB_SANITIZER AND (CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"))
244247
add_compile_options(/fsanitize=undefined)
248+
add_link_options(/INCREMENTAL:NO)
245249
endif()
246250
endif()
247251

0 commit comments

Comments
 (0)