]> git.tdb.fi Git - builder.git/blob - source/installcomponent.cpp
Replace basic for loops with range-based loops or algorithms
[builder.git] / source / installcomponent.cpp
1 #include "installcomponent.h"
2 #include "builder.h"
3 #include "file.h"
4 #include "sourcepackage.h"
5 #include "tool.h"
6
7 using namespace std;
8 using namespace Msp;
9
10 InstallComponent::InstallComponent(SourcePackage &p, const string &n):
11         Component(p, n)
12 { }
13
14 void InstallComponent::create_targets() const
15 {
16         Builder &builder = package.get_builder();
17         Target *inst = builder.get_build_graph().get_target("install");
18         Tool &copy = builder.get_toolchain().get_tool("CP");
19
20         for(const FS::Path &s: collect_source_files())
21         {
22                 Target *tgt = builder.get_vfs().get_target(s);
23                 if(!tgt)
24                         tgt = new File(builder, package, s);
25                 inst->add_dependency(*copy.create_target(*tgt, name));
26         }
27 }