diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-02-01 21:42:00 +1100 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-02-01 21:42:00 +1100 |
commit | 4b3c43649eef34ced681d76f515113038117492e (patch) | |
tree | 555d681fb0922c4997f8fa6aa444f5698ae14dc7 | |
parent | 9496637a709329f38dcabeee19844e1ac9308b0a (diff) | |
download | meson-4b3c43649eef34ced681d76f515113038117492e.zip meson-4b3c43649eef34ced681d76f515113038117492e.tar.gz meson-4b3c43649eef34ced681d76f515113038117492e.tar.bz2 |
Put internal include dirs at the beginning so they override ones coming from the system. Closes #372.
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 9acce5a..7581f27 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1435,6 +1435,23 @@ rule FORTRAN_DEP_HACK if curdir == '': curdir = '.' commands += compiler.get_include_args(curdir, False) + # -I args work differently than other ones. In them the + # first found directory is used whereas for other flags + # (such as -ffoo -fno-foo) the latest one is used. + # Therefore put the internal include directories here + # at the beginning so they override args coming from + # e.g. pkg-config. + for i in target.get_include_dirs(): + basedir = i.get_curdir() + for d in i.get_incdirs(): + expdir = os.path.join(basedir, d) + srctreedir = os.path.join(self.build_to_src, expdir) + bargs = compiler.get_include_args(expdir, i.is_system) + sargs = compiler.get_include_args(srctreedir, i.is_system) + commands += bargs + commands += sargs + for d in i.get_extra_build_dirs(): + commands += compiler.get_include_args(d, i.is_system) for d in target.external_deps: if d.need_threads(): commands += compiler.thread_flags() @@ -1476,17 +1493,6 @@ rule FORTRAN_DEP_HACK i = os.path.join(self.get_target_private_dir(target), compiler.get_pch_name(pchlist[0])) arr.append(i) pch_dep = arr - for i in target.get_include_dirs(): - basedir = i.get_curdir() - for d in i.get_incdirs(): - expdir = os.path.join(basedir, d) - srctreedir = os.path.join(self.build_to_src, expdir) - bargs = compiler.get_include_args(expdir, i.is_system) - sargs = compiler.get_include_args(srctreedir, i.is_system) - commands += bargs - commands += sargs - for d in i.get_extra_build_dirs(): - commands += compiler.get_include_args(d, i.is_system) custom_target_include_dirs = [] for i in target.generated: if isinstance(i, build.CustomTarget): |