Skip to content

Commit 7a97594

Browse files
committed
WIP win-vhid iter12: add ASan runtime DLL dir to test PATH (fixes 0xC0000135 in shared+ASan ctest)
1 parent afa7725 commit 7a97594

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/tests/CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,12 @@ if(WIN32)
5858
# build can locate it at launch (there is no rpath on Windows).
5959
set_tests_properties(ReadInterrupt PROPERTIES
6060
WORKING_DIRECTORY "$<TARGET_FILE_DIR:${HIDAPI_TEST_BACKEND}>")
61+
62+
# When built with ASan (MSVC), the test exe needs the ASan runtime DLL,
63+
# which lives next to the MSVC tools; add it to PATH (CMake >= 3.22).
64+
if(HIDAPI_ENABLE_ASAN AND MSVC AND NOT CMAKE_VERSION VERSION_LESS "3.22")
65+
get_filename_component(MSVC_BUILD_TOOLS_DIR "${CMAKE_LINKER}" DIRECTORY)
66+
set_property(TEST ReadInterrupt PROPERTY
67+
ENVIRONMENT_MODIFICATION "PATH=path_list_append:${MSVC_BUILD_TOOLS_DIR}")
68+
endif()
6169
endif()

0 commit comments

Comments
 (0)