From cb8e8a45795a4ae24b4b154ebb9182bff3745606 Mon Sep 17 00:00:00 2001 From: Pedro Navarro Date: Thu, 18 May 2017 12:59:20 -0700 Subject: [PATCH] Check if the arguments have spaces in them and add back the quotes argv parsing removes. This fixes issues with the MT flag among others. -MT "stubdata.d stubdata.o stubdata.ao" --- wrapper/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wrapper/main.cpp b/wrapper/main.cpp index 405fae7..a8a252e 100644 --- a/wrapper/main.cpp +++ b/wrapper/main.cpp @@ -289,7 +289,14 @@ bool parse(int argc, char **argv, Target &target) { char *arg = argv[i]; if (*arg != '-') { - target.args.push_back(arg); + // Check if the argument has spaces, we need to add back the quotes if + // that's the case + std::string argument = arg; + if (argument.find_first_of("\t\n ") != std::string::npos) { + argument = "\"" + argument + "\""; + } + + target.args.push_back(argument); continue; }