From 4fe1c3c083acecf7eabe46b67cb540e8390f3122 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 5 Nov 2019 11:34:47 +0200 Subject: Add support for supplying MSVC IFCPATH equivalent --- libbuild2/cc/compile-rule.cxx | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) (limited to 'libbuild2/cc/compile-rule.cxx') 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:: -- cgit v1.1