summaryrefslogtreecommitdiff
path: root/src/externals_manual.cc
blob: 4c1c5403256f3c83faac926737d6663a77befce5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// -*- c++ -*-
// Distributed under the BSD 2-Clause License.
// See accompanying file LICENSE for details.
#include "externals_manual.h"

#include <map>

#include "ctor.h"

#include "util.h"
#include "tools.h"

using namespace ctor;

extern std::map<std::string, std::string> external_includedir;
extern std::map<std::string, std::string> external_libdir;

int resolv(const Settings& settings, const ExternalConfiguration& config,
           const ExternalManual& ext, Flags& flags)
{
	auto tool_chain = getToolChain(config.system);

	flags = ext.flags;

	auto inc = external_includedir.find(config.name);
	if(inc != external_includedir.end())
	{
		append(flags.cflags, getOption(tool_chain, opt::include_path, inc->second));
		append(flags.cxxflags, getOption(tool_chain, opt::include_path, inc->second));
	}

	auto lib = external_libdir.find(config.name);
	if(lib != external_libdir.end())
	{
		append(flags.ldflags, getOption(tool_chain, opt::library_path, lib->second));
	}

	return 0;
}