aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/compile-rule.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2019-11-05 11:34:47 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2019-11-05 11:34:47 +0200
commit4fe1c3c083acecf7eabe46b67cb540e8390f3122 (patch)
tree62f60d60ed49d037c00dd82b0c8f5ecacba32689 /libbuild2/cc/compile-rule.cxx
parentb95fe77721b5d3f35d94e7f1292c9581034cd4bd (diff)
Add support for supplying MSVC IFCPATH equivalent
Diffstat (limited to 'libbuild2/cc/compile-rule.cxx')
-rw-r--r--libbuild2/cc/compile-rule.cxx23
1 files changed, 18 insertions, 5 deletions
diff --git a/libbuild2/cc/compile-rule.cxx b/libbuild2/cc/compile-rule.cxx
index c0f876c..98b78e1 100644
--- a/libbuild2/cc/compile-rule.cxx
+++ b/libbuild2/cc/compile-rule.cxx
@@ -5576,11 +5576,24 @@ namespace build2
for (const string& a: stor)
args.push_back (a.c_str ());
- // VC's IFCPATH takes precedence over /module:stdIfcDir so unset it
- // if we are using our own std modules.
- //
- if (!stdifc.empty ())
- env.push_back ("IFCPATH");
+ if (getenv ("IFCPATH"))
+ {
+ // VC's IFCPATH takes precedence over /module:stdIfcDir so unset it if
+ // we are using our own std modules.
+ //
+ if (!stdifc.empty ())
+ env.push_back ("IFCPATH");
+ }
+ else if (stdifc.empty ())
+ {
+ // Add the VC's default directory (should be only one).
+ //
+ if (sys_mod_dirs && !sys_mod_dirs->empty ())
+ {
+ args.push_back ("/module:stdIfcDir");
+ args.push_back (sys_mod_dirs->front ().string ().c_str ());
+ }
+ }
}
target_state compile_rule::