From 794335cf16b3c522b09b10dc5fb02c9554084f8a Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Tue, 4 Feb 2025 19:04:18 +0100 Subject: Add support for custom flags through env: CFLAGS, CXXFLAGS and LDFLAGS --- src/task_ld.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/task_ld.cc') diff --git a/src/task_ld.cc b/src/task_ld.cc index 69c3a8a..03745be 100644 --- a/src/task_ld.cc +++ b/src/task_ld.cc @@ -128,8 +128,13 @@ int TaskLD::runInner() } auto tool = compiler(); - const auto& c = ctor::get_configuration(); - auto res = execute(settings, tool, args, c.env, is_self); + const auto& cfg = ctor::get_configuration(); + auto ldflags = cfg.getenv("LDFLAGS"); + if(!ldflags.empty()) + { + append(args, ld_option(toolchain, ctor::ld_opt::custom, ldflags)); + } + auto res = execute(settings, tool, args, cfg.env, is_self); if(res != 0) { std::filesystem::remove(targetFile()); -- cgit v1.2.3