aboutsummaryrefslogtreecommitdiff
path: root/build2/cxx/compile.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-01-27 14:19:23 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-01-27 14:19:23 +0200
commit7f74396e5e02b83ea511684cef318348f18840e1 (patch)
treeb5f5ec9b9d02d7a65d3808c2860dc28934e6be40 /build2/cxx/compile.cxx
parenta5949f9e974171144dba84771a9f305f9e1dcc3f (diff)
Add support for Mac OS target (-dynamiclib, -install_name, @rpath, .dylib)
Diffstat (limited to 'build2/cxx/compile.cxx')
-rw-r--r--build2/cxx/compile.cxx12
1 files changed, 10 insertions, 2 deletions
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<string> (*rs["config.cxx"]));
+ const string& sys (as<string> (*rs["cxx.host.system"]));
cstrings args {cxx.c_str ()};
@@ -400,7 +401,10 @@ namespace build2
append_std (args, t, std);
if (t.is_a<objso> ())
- 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<string> (*rs["config.cxx"]));
+ const string& sys (as<string> (*rs["cxx.host.system"]));
cstrings args {cxx.c_str ()};
@@ -744,7 +749,10 @@ namespace build2
append_std (args, t, std);
if (t.is_a<objso> ())
- 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 ());