aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc/compile-rule.cxx
diff options
context:
space:
mode:
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::