diff --git a/CTestCustom.cmake b/CTestCustom.cmake
index b0e42d58d30d59d31f17766672f39e151704fc39..9ea81950a51650911b1c9c8396609b054051c70a 100644
--- a/CTestCustom.cmake
+++ b/CTestCustom.cmake
@@ -105,7 +105,7 @@ if(NOT @RUN_LONG_TESTS@)
             endforeach(size)
           endif ()
         endforeach(p_or_s)
-      endforeach(ver)
+      endforeach(oldver)
     endif ()
   endforeach(test)
 endif()
diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt
index 28b0ff292a3f4f9420fa58fac875f5e31514b3db..d053d2e6f25e6bafda0e3dcbb35ae165cf0f824c 100644
--- a/src/tests/CMakeLists.txt
+++ b/src/tests/CMakeLists.txt
@@ -466,7 +466,7 @@ if(BUILD_TESTING)
             endforeach(size)
           endif ()
         endforeach(p_or_s)
-      endforeach(ver)
+      endforeach(oldver)
     endif ()
   endforeach(src)