diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-12-11 21:51:38 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2016-12-13 14:19:34 +0200 |
commit | b01d2c35b7003071fc64c6d2e7d07b7652a8b386 (patch) | |
tree | 674816b79fd79d9b57384481c98408700db38d48 /mesonbuild | |
parent | de83e94b5a9ce0f540814cee40ef3746b6ebb824 (diff) | |
download | meson-b01d2c35b7003071fc64c6d2e7d07b7652a8b386.zip meson-b01d2c35b7003071fc64c6d2e7d07b7652a8b386.tar.gz meson-b01d2c35b7003071fc64c6d2e7d07b7652a8b386.tar.bz2 |
Only add build dir inlude directives if the corresponding dir exists. Closes #1185.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 11 | ||||
-rw-r--r-- | mesonbuild/compilers.py | 4 |
2 files changed, 12 insertions, 3 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 3562cf8..acbf4a4 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1778,7 +1778,16 @@ rule FORTRAN_DEP_HACK 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) + # There may be include dirs where a build directory has not been + # created for some source dir. For example if someone does this: + # + # inc = include_directories('foo/bar/baz') + # + # But never subdir()s into the actual dir. + if os.path.isdir(os.path.join(self.environment.get_build_dir(), expdir)): + bargs = compiler.get_include_args(expdir, i.is_system) + else: + bargs = [] sargs = compiler.get_include_args(srctreedir, i.is_system) commands += bargs commands += sargs diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 93245f3..dcb4b69 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -1975,7 +1975,7 @@ class VisualStudioCCompiler(CCompiler): # msvc does not have a concept of system header dirs. return ['-I' + path] - # Visual Studio is special. It ignores arguments it does not + # Visual Studio is special. It ignores some arguments it does not # understand and you can't tell it to error out on those. # http://stackoverflow.com/questions/15259720/how-can-i-make-the-microsoft-c-compiler-treat-unknown-flags-as-errors-rather-t def has_multi_arguments(self, args, env): @@ -1994,7 +1994,7 @@ class VisualStudioCCompiler(CCompiler): mlog.debug('Code:\n', code) p, stdo, stde = Popen_safe(commands, cwd=os.path.split(srcname)[0]) if p.returncode != 0: - raise MesonException('Compiling test app failed.') + return False return not(warning_text in stde or warning_text in stdo) def get_compile_debugfile_args(self, rel_obj, pch=False): |