diff options
author | Ralf Gommers <ralf.gommers@gmail.com> | 2022-05-29 23:40:01 +0200 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-07-06 15:17:01 -0400 |
commit | 17936686d473fe07b6a7cf1c3b80a21f220ce06e (patch) | |
tree | d967ef19e3f2016a001594ba3cc8b9d19e65c5f4 | |
parent | af846a109f70b0b063b9d3c7a30225a22949bb48 (diff) | |
download | meson-17936686d473fe07b6a7cf1c3b80a21f220ce06e.zip meson-17936686d473fe07b6a7cf1c3b80a21f220ce06e.tar.gz meson-17936686d473fe07b6a7cf1c3b80a21f220ce06e.tar.bz2 |
Improve error message for `include_directories(abs_path_intree)`
This error message was quite confusing when triggered by
use of an absolute path to the include dir of an external dependency
(numpy in my case). Changing that to a relative dir also isn't
a solution, because Meson will *not* do the "busywork to make paths
work" that the error message says it will.
-rw-r--r-- | mesonbuild/interpreter/interpreter.py | 9 | ||||
-rw-r--r-- | test cases/failing/44 abspath to srcdir/test.json | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py index 778a4d6..4191bee 100644 --- a/mesonbuild/interpreter/interpreter.py +++ b/mesonbuild/interpreter/interpreter.py @@ -2583,8 +2583,9 @@ class Interpreter(InterpreterBase, HoldableObject): for a in incdir_strings: if a.startswith(src_root): raise InvalidArguments(textwrap.dedent('''\ - Tried to form an absolute path to a source dir. - You should not do that but use relative paths instead. + Tried to form an absolute path to a dir in the source tree. + You should not do that but use relative paths instead, for + directories that are part of your project. To get include path to any directory relative to the current dir do @@ -2599,6 +2600,10 @@ class Interpreter(InterpreterBase, HoldableObject): put in the include directories by default so you only need to do include_directories('.') if you intend to use the result in a different subdirectory. + + Note that this error message can also be triggered by + external dependencies being installed within your source + tree - it's not recommended to do this. ''')) else: try: diff --git a/test cases/failing/44 abspath to srcdir/test.json b/test cases/failing/44 abspath to srcdir/test.json index 2cc2980..c64ecfb 100644 --- a/test cases/failing/44 abspath to srcdir/test.json +++ b/test cases/failing/44 abspath to srcdir/test.json @@ -1,7 +1,7 @@ { "stdout": [ { - "line": "test cases/failing/44 abspath to srcdir/meson.build:3:0: ERROR: Tried to form an absolute path to a source dir." + "line": "test cases/failing/44 abspath to srcdir/meson.build:3:0: ERROR: Tried to form an absolute path to a dir in the source tree." } ] } |