diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2020-08-08 15:37:51 +0200 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2020-08-09 19:36:38 +0300 |
commit | a98db022aa4cc0798fba4bb2f723e5b0cc3b2570 (patch) | |
tree | 95c445f899f3dbed7f86b219a7fd97df7c3806cf /mesonbuild | |
parent | 948741355f1d624f209e2b2d02740372fc9aa8c2 (diff) | |
download | meson-a98db022aa4cc0798fba4bb2f723e5b0cc3b2570.zip meson-a98db022aa4cc0798fba4bb2f723e5b0cc3b2570.tar.gz meson-a98db022aa4cc0798fba4bb2f723e5b0cc3b2570.tar.bz2 |
cmake: Detect custom command targets in compiler args
This is required to make `-include /path/to/custom/target.hpp`
work. This setup is used by wxWidgets and this PR is
required to use wxWidgets as a CMake subproject.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/cmake/interpreter.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py index 9749c4c..c2affd0 100644 --- a/mesonbuild/cmake/interpreter.py +++ b/mesonbuild/cmake/interpreter.py @@ -279,7 +279,7 @@ class ConverterTarget: std_regex = re.compile(r'([-]{1,2}std=|/std:v?|[-]{1,2}std:)(.*)') def postprocess(self, output_target_map: OutputTargetMap, root_src_dir: str, subdir: str, install_prefix: str, trace: CMakeTraceParser) -> None: - # Detect setting the C and C++ standard + # Detect setting the C and C++ standard and do additional compiler args manipulation for i in ['c', 'cpp']: if i not in self.compile_opts: continue @@ -287,6 +287,7 @@ class ConverterTarget: temp = [] for j in self.compile_opts[i]: m = ConverterTarget.std_regex.match(j) + ctgt = output_target_map.generated(j) if m: std = m.group(2) supported = self._all_lang_stds(i) @@ -301,6 +302,12 @@ class ConverterTarget: self.override_options += ['{}_std={}'.format(i, std)] elif j in ['-fPIC', '-fpic', '-fPIE', '-fpie']: self.pie = True + elif isinstance(ctgt, ConverterCustomTarget): + # Sometimes projects pass generated source files as compiler + # flags. Add these as generated sources to ensure that the + # corresponding custom target is run.2 + self.generated += [j] + temp += [j] elif j in blacklist_compiler_flags: pass else: |