diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-02-04 19:04:18 +0100 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2025-02-04 19:04:18 +0100 |
commit | 794335cf16b3c522b09b10dc5fb02c9554084f8a (patch) | |
tree | e1947e5dcd4f3b4dbdab1beacf7a66a577b06690 /src/task_cc.cc | |
parent | f4b6372c1fe8d48aceb853272e0b822b967a56d7 (diff) |
Add support for custom flags through env: CFLAGS, CXXFLAGS and LDFLAGS
Diffstat (limited to 'src/task_cc.cc')
-rw-r--r-- | src/task_cc.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/task_cc.cc b/src/task_cc.cc index b9edcf7..97e99af 100644 --- a/src/task_cc.cc +++ b/src/task_cc.cc @@ -191,7 +191,33 @@ int TaskCC::runInner() std::cout << output << std::flush; } + auto toolchain = getToolChain(config.system); const auto& cfg = ctor::get_configuration(); + switch(sourceLanguage()) + { + case ctor::language::c: + { + auto cflags = cfg.getenv("CFLAGS"); + if(!cflags.empty()) + { + append(args, c_option(toolchain, ctor::c_opt::custom, cflags)); + } + } + break; + case ctor::language::cpp: + { + auto cxxflags = cfg.getenv("CXXFLAGS"); + if(!cxxflags.empty()) + { + append(args, cxx_option(toolchain, ctor::cxx_opt::custom, cxxflags)); + } + } + break; + case ctor::language::automatic: + case ctor::language::assembler: + // Only c/c++ handled by this task type. + break; + } auto res = execute(settings, compiler(), args, cfg.env); if(res != 0) { |