summaryrefslogtreecommitdiff
path: root/src/task_ld.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/task_ld.cc')
-rw-r--r--src/task_ld.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/task_ld.cc b/src/task_ld.cc
index 3d917e4..e619dfd 100644
--- a/src/task_ld.cc
+++ b/src/task_ld.cc
@@ -30,6 +30,8 @@ TaskLD::TaskLD(const ctor::build_configuration& config,
std::filesystem::create_directories(std::filesystem::path(settings.builddir) / sourceDir);
_targetFile = target;
+ auto toolchain = getToolChain(config.system);
+ _targetFile = extension(toolchain, target_type, _targetFile);
for(const auto& object : objects)
{
std::filesystem::path objectFile = object;
@@ -88,14 +90,16 @@ int TaskLD::runInner()
for(const auto& dep : getDependsTasks())
{
auto depFile = dep->targetFile();
- if(depFile.extension() == ".so")
+ auto dep_type = target_type_from_extension(toolchain, depFile);
+ if(dep_type == ctor::target_type::dynamic_library)
{
append(args, ld_option(toolchain, ctor::ld_opt::library_path,
targetFile().parent_path().string()));
auto lib = depFile.stem().string().substr(3); // strip 'lib' prefix
append(args, ld_option(toolchain, ctor::ld_opt::link, lib));
}
- else if(depFile.extension() == ".a" || depFile.extension() == ".o")
+ else if(dep_type == ctor::target_type::static_library ||
+ dep_type == ctor::target_type::object)
{
args.push_back(depFile.string());
}