From 86a4d704bcf1003f1726957c22f9eb9905f021aa Mon Sep 17 00:00:00 2001 From: Georg Schwab Date: Wed, 14 Apr 2021 08:35:59 +0200 Subject: [PATCH] fixed inconsistent semicolon expansion in catch_discover_tests (Bug #2214) --- contrib/CatchAddTests.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/contrib/CatchAddTests.cmake b/contrib/CatchAddTests.cmake index 18286b71..184e506e 100644 --- a/contrib/CatchAddTests.cmake +++ b/contrib/CatchAddTests.cmake @@ -16,7 +16,10 @@ set(tests) function(add_command NAME) set(_args "") - foreach(_arg ${ARGN}) + # use ARGV* instead of ARGN, because ARGN splits arrays into multiple arguments + math(EXPR _last_arg ${ARGC}-1) + foreach(_n RANGE 1 ${_last_arg}) + set(_arg "${ARGV${_n}}") if(_arg MATCHES "[^-./:a-zA-Z0-9_]") set(_args "${_args} [==[${_arg}]==]") # form a bracket_argument else()