From: Mikko Rasa Date: Thu, 30 Aug 2018 11:06:03 +0000 (+0300) Subject: Add support for statically linking the C++ standard library X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=bc85cc286c8a3f1055f1979a7ff8697cf1b61912;p=builder.git Add support for statically linking the C++ standard library It can be requested by setting the libmode for "stdc++" as STATIC. --- diff --git a/source/gnulinker.cpp b/source/gnulinker.cpp index a132ace..51da81f 100644 --- a/source/gnulinker.cpp +++ b/source/gnulinker.cpp @@ -338,8 +338,18 @@ Task *GnuLinker::Linker::run(const Target &target) const if(static_link_ok) argv.push_back("-static"); - else if(architecture->get_system()=="windows") - argv.push_back("-Wl,--enable-auto-import"); + else + { + if(compiler_tag=="CXX") + { + BuildInfo::LibModeMap::const_iterator i = binfo.libmodes.find("stdc++"); + if(i!=binfo.libmodes.end() && i->second<=BuildInfo::STATIC) + argv.push_back("-static-libstdc++"); + } + + if(architecture->get_system()=="windows") + argv.push_back("-Wl,--enable-auto-import"); + } return new ExternalTask(argv, work_dir); }