aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build2/cc/compile-rule.cxx22
1 files changed, 16 insertions, 6 deletions
diff --git a/build2/cc/compile-rule.cxx b/build2/cc/compile-rule.cxx
index b06b03b..079be88 100644
--- a/build2/cc/compile-rule.cxx
+++ b/build2/cc/compile-rule.cxx
@@ -1083,15 +1083,25 @@ namespace build2
continue;
dir_path d;
- if (o.size () == 2)
+
+ try
{
- if (++i == e)
- break; // Let the compiler complain.
+ if (o.size () == 2)
+ {
+ if (++i == e)
+ break; // Let the compiler complain.
- d = dir_path (*i);
+ d = dir_path (*i);
+ }
+ else
+ d = dir_path (*i, 2, string::npos);
+ }
+ catch (const invalid_path& e)
+ {
+ fail << "invalid -I directory " << e.path
+ << " in variable " << var.name
+ << " for target " << t;
}
- else
- d = dir_path (*i, 2, string::npos);
l6 ([&]{trace << "-I " << d;});