summaryrefslogtreecommitdiff
path: root/task_so.cc
diff options
context:
space:
mode:
Diffstat (limited to 'task_so.cc')
-rw-r--r--task_so.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/task_so.cc b/task_so.cc
index c484a40..1f5d204 100644
--- a/task_so.cc
+++ b/task_so.cc
@@ -40,7 +40,7 @@ TaskSO::TaskSO(const BuildConfiguration& config,
const Settings& settings,
const std::string& target,
const std::vector<std::string>& objects)
- : Task(addPrefix(config.depends, settings))
+ : Task(config, addPrefix(config.depends, settings))
, config(config)
, settings(settings)
{
@@ -62,6 +62,17 @@ TaskSO::TaskSO(const BuildConfiguration& config,
flagsFile = settings.builddir / targetFile.stem();
flagsFile += ".flags";
+
+ target_type = TargetType::DynamicLibrary;
+ _language = Language::C;
+ for(const auto& source : config.sources)
+ {
+ std::filesystem::path sourceFile(source);
+ if(sourceFile.extension().string() != ".c")
+ {
+ _language = Language::Cpp;
+ }
+ }
}
bool TaskSO::dirtyInner()
@@ -142,7 +153,13 @@ int TaskSO::runInner()
std::cout << "LD => " << targetFile.string() << "\n";
}
- return execute("/usr/bin/g++", args, settings.verbose > 0);
+ auto tool = getConfiguration("host-cpp", "/usr/bin/g++");
+ if(language() == Language::C)
+ {
+ tool = getConfiguration("host-cc", "/usr/bin/gcc");
+ }
+
+ return execute(tool, args, settings.verbose > 0);
}
int TaskSO::clean()