From 8e004afc90ee82c7e51817d8a7046a894eb90485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20W=C3=BCrl?= Date: Sun, 30 Aug 2020 18:22:45 +0200 Subject: CMake module: Allow paths of generated CMake sources for include directories --- mesonbuild/cmake/interpreter.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'mesonbuild/cmake/interpreter.py') diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py index c2affd0..8a7122d 100644 --- a/mesonbuild/cmake/interpreter.py +++ b/mesonbuild/cmake/interpreter.py @@ -432,9 +432,17 @@ class ConverterTarget: if not os.path.isabs(x): x = os.path.normpath(os.path.join(self.src_dir, x)) if not os.path.exists(x) and not any([x.endswith(y) for y in obj_suffixes]) and not is_generated: - mlog.warning('CMake: path', mlog.bold(x), 'does not exist.') - mlog.warning(' --> Ignoring. This can lead to build errors.') - return None + if ( + any([os.path.commonpath([x, y]) == x for y in self.generated]) + and os.path.isabs(x) + and os.path.commonpath([x, self.env.get_build_dir()]) == self.env.get_build_dir() + ): + os.makedirs(x) + return os.path.relpath(x, os.path.join(self.env.get_build_dir(), subdir)) + else: + mlog.warning('CMake: path', mlog.bold(x), 'does not exist.') + mlog.warning(' --> Ignoring. This can lead to build errors.') + return None if Path(x) in trace.explicit_headers: return None if ( -- cgit v1.1