Fix CTest command issue with square brackets

This commit is contained in:
Steven Franzen 2019-07-21 16:29:46 +02:00
parent fb74bb133c
commit 2aed6233cf
No known key found for this signature in database
GPG Key ID: C35752984A323287
1 changed files with 5 additions and 2 deletions

View File

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