summaryrefslogtreecommitdiff
path: root/mesonbuild/cmake
diff options
context:
space:
mode:
authorL. E. Segovia <amy@amyspark.me>2023-08-30 18:10:15 -0300
committerDylan Baker <dylan@pnwbakers.com>2024-01-16 11:00:26 -0800
commit9797f7682b638427a567ab9ab354a8cc63ac1010 (patch)
tree700acdfb509ed5d431cf6d053d8880b88f2c99b6 /mesonbuild/cmake
parent0bfe98e7e62b62b96448c48e9d06409bbfdf8bc0 (diff)
downloadmeson-9797f7682b638427a567ab9ab354a8cc63ac1010.tar.gz
cmake: Fix blunt target filtering skipping GENERATED dependencies
GENERATED files can be used as dependencies for other targets, so it's misguided (at best) to filter them with a blunt whitelist. However, there does exist an extension that needs to be skipped: on Windows + MSVC, CMake will by default try to generate a Visual Studio project, and there dependencies with no inputs are instead tied to a dummy .rule input file which is created by the generation step. The fileapi will still report those, so it will cause Meson to bail out when it realises there's no such file in the build tree. Fixes #11607
Diffstat (limited to 'mesonbuild/cmake')
-rw-r--r--mesonbuild/cmake/interpreter.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py
index 14e15b8fd..68cbea497 100644
--- a/mesonbuild/cmake/interpreter.py
+++ b/mesonbuild/cmake/interpreter.py
@@ -362,7 +362,15 @@ class ConverterTarget:
supported += list(lang_suffixes[i])
supported = [f'.{x}' for x in supported]
self.sources = [x for x in self.sources if any(x.name.endswith(y) for y in supported)]
- self.generated_raw = [x for x in self.generated_raw if any(x.name.endswith(y) for y in supported)]
+ # Don't filter unsupported files from generated_raw because they
+ # can be GENERATED dependencies for other targets.
+ # See: https://github.com/mesonbuild/meson/issues/11607
+ # However, the dummy CMake rule files for Visual Studio still
+ # need to be filtered out. They don't exist (because the project was
+ # not generated at this time) but the fileapi will still
+ # report them on Windows.
+ # See: https://stackoverflow.com/a/41816323
+ self.generated_raw = [x for x in self.generated_raw if not x.name.endswith('.rule')]
# Make paths relative
def rel_path(x: Path, is_header: bool, is_generated: bool) -> T.Optional[Path]: