better ctest integration across the board

This commit is contained in:
Marcos Slomp
2026-06-05 10:37:27 -07:00
parent d89c956394
commit 10d64d69b5

View File

@@ -38,6 +38,15 @@ target_link_libraries(test_graphid_recycle PRIVATE CUDA::cupti CUDA::cuda_driver
set(_all_targets repro test_corr_reuse test_graphid_recycle)
# ctest-related integration below
# to run the binaries via ctest:
# ctest --test-dir <cmake-build-dir> -R <binary-name> -C <build-config>
enable_testing()
foreach(_target ${_all_targets})
add_test(NAME ${_target} COMMAND ${_target})
endforeach()
# On Windows, CUPTI's DLL must be on PATH at runtime.
# Propagate the DLL directory to both the VS debugger and ctest.
if(WIN32)
@@ -45,11 +54,6 @@ if(WIN32)
foreach(_target ${_all_targets})
set_target_properties(${_target} PROPERTIES
VS_DEBUGGER_ENVIRONMENT "PATH=${_cupti_dir};$ENV{PATH}")
endforeach()
enable_testing()
foreach(_target ${_all_targets})
add_test(NAME ${_target} COMMAND ${_target})
set_tests_properties(${_target} PROPERTIES
ENVIRONMENT "PATH=${_cupti_dir};$ENV{PATH}")
endforeach()