diff --git a/CMakeModules/testing_cpp.cmake b/CMakeModules/testing_cpp.cmake
index 30a0930d7574306fb6eae2a633fe95f58baf6c5e..1c873ac8684df8dba1be0bf8a355f8021c8d6cf6 100644
--- a/CMakeModules/testing_cpp.cmake
+++ b/CMakeModules/testing_cpp.cmake
@@ -218,7 +218,7 @@ function(add_script_test testname arguments)
                     separate_arguments(memargs)
                     add_test(NAME memtest-${testname} COMMAND bash ${CMAKE_CURRENT_SOURCE_DIR}/check_linux.sh
                             ${memargs})
-                    set_tests_properties(test-${testname} PROPERTIES ENVIRONMENT "${TOKENS}")
+                    set_tests_properties(memtest-${testname} PROPERTIES ENVIRONMENT "${TOKENS}")
                     set_tests_properties(memtest-${testname} PROPERTIES
                             LABELS "memcheck_${label};all"
                             DEPENDS test-${testname}