diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-02-14 23:20:54 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-02-17 15:42:53 -0500 |
commit | 28353e10e19f8516191806be5b7ed7dda0378138 (patch) | |
tree | 442e542dd2aea88e0be3767cd0b598e79a2e071d /mesonbuild/interpreter.py | |
parent | 15b6915954c7c3d7a06455aeb7995524ac43ff3b (diff) | |
download | meson-28353e10e19f8516191806be5b7ed7dda0378138.zip meson-28353e10e19f8516191806be5b7ed7dda0378138.tar.gz meson-28353e10e19f8516191806be5b7ed7dda0378138.tar.bz2 |
Prohibit manually built paths that point in srcdir in include_directories and give information on what to use instead.
Diffstat (limited to 'mesonbuild/interpreter.py')
-rw-r--r-- | mesonbuild/interpreter.py | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 4466f22..bcc7977 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -2255,8 +2255,27 @@ requirements use the version keyword argument instead.''') @stringArgs def func_include_directories(self, node, args, kwargs): - absbase = os.path.join(self.environment.get_source_dir(), self.subdir) + src_root = self.environment.get_source_dir() + absbase = os.path.join(src_root, self.subdir) for a in args: + if a.startswith(src_root): + raise InvalidArguments('''Tried to form an absolute path to a source dir. You should not do that but use +relative paths instead. + +To get include path to any directory relative to the current dir do + +incdir = include_directories(dirname) + +After this incdir will contain both the current source dir as well as the +corresponding build dir. It can then be used in any subdirectory and +Meson will take care of all the busywork to make paths work. + +Dirname can even be '.' to mark the current directory. Though you should +remember that the current source and build directories are always +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. +''') absdir = os.path.join(absbase, a) if not os.path.isdir(absdir): raise InvalidArguments('Include dir %s does not exist.' % a) |