diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl index 599b521014..f3394905f0 100644 --- a/src/tools/msvc/vcregress.pl +++ b/src/tools/msvc/vcregress.pl @@ -619,13 +619,18 @@ sub fetchRegressOpts $m =~ s{\\\r?\n}{}g; if ($m =~ /^\s*REGRESS_OPTS\s*\+?=(.*)/m) { + my @split_opts = split(/\s+/, $1); - # Substitute known Makefile variables, then ignore options that retain - # an unhandled variable reference. Ignore anything that isn't an - # option starting with "--". - @opts = grep { !/\$\(/ && /^--/ } - map { (my $x = $_) =~ s/\Q$(top_builddir)\E/\"$topdir\"/; $x; } - split(/\s+/, $1); + # Substitute known Makefile variables for each option by + # something which is supported in this context. + foreach my $opt (@split_opts) + { + # ignore empty strings + next if ($opt =~ /^\s*$/); + $opt =~ s#\$\(top_builddir\)#"$topdir"#gs; + $opt =~ s#\$\(top_srcdir\)#"$topdir"#gs; + push @opts, $opt; + } } if ($m =~ /^\s*ENCODING\s*=\s*(\S+)/m) {