From 7f74396e5e02b83ea511684cef318348f18840e1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 27 Jan 2016 14:19:23 +0200 Subject: Add support for Mac OS target (-dynamiclib, -install_name, @rpath, .dylib) --- build2/cxx/compile.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'build2/cxx/compile.cxx') diff --git a/build2/cxx/compile.cxx b/build2/cxx/compile.cxx index 9e65eda..db63700 100644 --- a/build2/cxx/compile.cxx +++ b/build2/cxx/compile.cxx @@ -375,6 +375,7 @@ namespace build2 scope& rs (t.root_scope ()); const string& cxx (as (*rs["config.cxx"])); + const string& sys (as (*rs["cxx.host.system"])); cstrings args {cxx.c_str ()}; @@ -400,7 +401,10 @@ namespace build2 append_std (args, t, std); if (t.is_a ()) - args.push_back ("-fPIC"); + { + if (sys != "darwin") // fPIC by default. + args.push_back ("-fPIC"); + } args.push_back ("-M"); // Note: -MM -MG skips missing <>-included. args.push_back ("-MG"); // Treat missing headers as generated. @@ -723,6 +727,7 @@ namespace build2 scope& rs (t.root_scope ()); const string& cxx (as (*rs["config.cxx"])); + const string& sys (as (*rs["cxx.host.system"])); cstrings args {cxx.c_str ()}; @@ -744,7 +749,10 @@ namespace build2 append_std (args, t, std); if (t.is_a ()) - args.push_back ("-fPIC"); + { + if (sys != "darwin") // fPIC by default. + args.push_back ("-fPIC"); + } args.push_back ("-o"); args.push_back (relo.string ().c_str ()); -- cgit v1.1