diff --git a/pub/utest/CMakeLists.txt b/pub/utest/CMakeLists.txt
index 79a53c6da53a157c88123554281242d3af129b00..1ced2ef640c84db9166a5e1e70d1b9a98f8513bf 100644
--- a/pub/utest/CMakeLists.txt
+++ b/pub/utest/CMakeLists.txt
@@ -37,6 +37,6 @@ list(SORT test_sources)
 foreach(test_src ${test_sources})
     # remove directory path and suffix, to retain just the name of the test
     string(REGEX REPLACE ".*/" "" test_name "${test_src}")
-    string(REGEX REPLACE ".cpp$" "" test_name "${test_name}")
+    string(REGEX REPLACE "\\.cpp$" "" test_name "${test_name}")
     cxx_test(${test_name} "${test_link_libs}")
 endforeach(test_src)