aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-09-07 19:22:29 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-09-11 14:50:35 +0530
commit5b1babd611e32e131bd8695b484a5eb67e1026c4 (patch)
tree7d53a3df02327eb57ca72e47ed8618010002fa79 /mesonbuild/backend
parent21e2315afd90e844963ca1c982ba70a4e001efaf (diff)
downloadmeson-5b1babd611e32e131bd8695b484a5eb67e1026c4.zip
meson-5b1babd611e32e131bd8695b484a5eb67e1026c4.tar.gz
meson-5b1babd611e32e131bd8695b484a5eb67e1026c4.tar.bz2
backends: Add custom target inc dirs before target inc dirs
Custom target include dirs must be overridable by target-specific include dirs otherwise in case of header name collisions, the user has no way to override this behaviour.
Diffstat (limited to 'mesonbuild/backend')
-rw-r--r--mesonbuild/backend/ninjabackend.py16
-rw-r--r--mesonbuild/backend/vs2010backend.py8
2 files changed, 15 insertions, 9 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index dce3b80..bff173a 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -2038,6 +2038,12 @@ rule FORTRAN_DEP_HACK
# Add compiler args and include paths from several sources; defaults,
# build options, external dependencies, etc.
commands += self.generate_basic_compiler_args(target, compiler, no_warn_args)
+ # Add custom target dirs as includes automatically, but before
+ # target-specific include directories.
+ # XXX: Not sure if anyone actually uses this? It can cause problems in
+ # situations which increase the likelihood for a header name collision,
+ # such as in subprojects.
+ commands += self.get_custom_target_dir_include_args(target, compiler)
# Add include dirs from the `include_directories:` kwarg on the target
# and from `include_directories:` of internal deps of the target.
#
@@ -2081,14 +2087,12 @@ rule FORTRAN_DEP_HACK
# from external dependencies, internal dependencies, and from
# per-target `include_directories:`
#
- # We prefer headers in the build dir and the custom target dir over the
- # source dir since, for instance, the user might have an
- # srcdir == builddir Autotools build in their source tree. Many
- # projects that are moving to Meson have both Meson and Autotools in
- # parallel as part of the transition.
+ # We prefer headers in the build dir over the source dir since, for
+ # instance, the user might have an srcdir == builddir Autotools build
+ # in their source tree. Many projects that are moving to Meson have
+ # both Meson and Autotools in parallel as part of the transition.
if target.implicit_include_directories:
commands += self.get_source_dir_include_args(target, compiler)
- commands += self.get_custom_target_dir_include_args(target, compiler)
if target.implicit_include_directories:
commands += self.get_build_dir_include_args(target, compiler)
# Finally add the private dir for the target to the include path. This
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index 00ee34a..ec5ad7d 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -763,6 +763,10 @@ class Vs2010Backend(backends.Backend):
# This is where Visual Studio will insert target_args, target_defines,
# etc, which are added later from external deps (see below).
args += ['%(AdditionalOptions)', '%(PreprocessorDefinitions)', '%(AdditionalIncludeDirectories)']
+ # Add custom target dirs as includes automatically, but before
+ # target-specific include dirs. See _generate_single_compile() in
+ # the ninja backend for caveats.
+ args += ['-I' + arg for arg in generated_files_include_dirs]
# Add include dirs from the `include_directories:` kwarg on the target
# and from `include_directories:` of internal deps of the target.
#
@@ -789,14 +793,12 @@ class Vs2010Backend(backends.Backend):
if l in file_args:
file_args[l] += args
# The highest priority includes. In order of directory search:
- # target private dir, target build dir, generated sources include dirs,
- # target source dir
+ # target private dir, target build dir, target source dir
for args in file_args.values():
t_inc_dirs = [self.relpath(self.get_target_private_dir(target),
self.get_target_dir(target))]
if target.implicit_include_directories:
t_inc_dirs += ['.']
- t_inc_dirs += generated_files_include_dirs
if target.implicit_include_directories:
t_inc_dirs += [proj_to_src_dir]
args += ['-I' + arg for arg in t_inc_dirs]