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}"