]> git.tdb.fi Git - builder.git/commitdiff
Allow overriding tool commands on the command line
authorMikko Rasa <tdb@tdb.fi>
Sun, 5 Oct 2014 11:46:28 +0000 (14:46 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sun, 5 Oct 2014 11:46:28 +0000 (14:46 +0300)
source/buildercli.cpp

index c0a4f06c8f10c1b692b39c7a79798cf361a362e6..0ce2bdc4ababa4a259820e0097e1214789df250c 100644 (file)
@@ -8,6 +8,8 @@
 #include "buildercli.h"
 #include "filetarget.h"
 #include "sourcepackage.h"
+#include "tool.h"
+#include "toolchain.h"
 
 using namespace std;
 using namespace Msp;
@@ -165,6 +167,18 @@ BuilderCLI::BuilderCLI(int argc, char **argv):
                builder.set_build_type(build_type);
 
        builder.add_default_tools();
+
+       const Toolchain &toolchain = builder.get_toolchain();
+       for(Config::InputOptions::iterator i=cmdline_options.begin(); i!=cmdline_options.end(); )
+       {
+               if(toolchain.has_tool(i->first))
+               {
+                       toolchain.get_tool(i->first).set_command(i->second);
+                       cmdline_options.erase(i++);
+               }
+               else
+                       ++i;
+       }
 }
 
 BuilderCLI::~BuilderCLI()