From 2aed6233cf38d24267184274264f84b4a8d43bc6 Mon Sep 17 00:00:00 2001 From: Steven Franzen Date: Sun, 21 Jul 2019 16:29:46 +0200 Subject: [PATCH] Fix CTest command issue with square brackets --- contrib/CatchAddTests.cmake | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/CatchAddTests.cmake b/contrib/CatchAddTests.cmake index 2220ce3a..156d55ff 100644 --- a/contrib/CatchAddTests.cmake +++ b/contrib/CatchAddTests.cmake @@ -51,8 +51,11 @@ string(REPLACE "\n" ";" output "${output}") # Parse output foreach(line ${output}) set(test ${line}) - # use escape commas to handle properly test cases with commans inside the name - string(REPLACE "," "\\," test_name ${test}) + # Escape characters in test case names that would be parsed by Catch2 + set(test_name ${test}) + foreach(char , [ ]) + string(REPLACE ${char} "\\${char}" test_name ${test_name}) + endforeach(char) # ...and add to script add_command(add_test "${prefix}${test}${suffix}"