From 23a1ab205c777330453a8137557cd02754533748 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 17 May 2017 14:41:06 +0200 Subject: Lazily diagnose relative -I paths --- build2/cc/compile.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build2/cc/compile.cxx b/build2/cc/compile.cxx index 57803a5..32b5f6e 100644 --- a/build2/cc/compile.cxx +++ b/build2/cc/compile.cxx @@ -664,9 +664,14 @@ namespace build2 l6 ([&]{trace << "-I '" << d << "'";}); - // If we are relative or not inside our project root, then ignore. + if (d.relative ()) + fail << "relative -I directory " << d + << " in variable " << var.name + << " for target " << t; + + // If we are not inside our project root, then ignore. // - if (d.relative () || !d.sub (out_root)) + if (!d.sub (out_root)) continue; // If the target directory is a sub-directory of the include @@ -1071,7 +1076,8 @@ namespace build2 // then, well, we will just have to get rid of quoted includes // (which are generally a bad idea, anyway). // - // @@ Detect/handle relative paths in -I and error out? + // Note that we detect and diagnose relative -I directories lazily + // when building the include prefix map. // rels = relative (src.path ()); -- cgit v1.1