diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-08-05 23:09:38 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-05 23:09:38 +0300 |
commit | 461cb7d5345d6811547d121078dcb26af9310a35 (patch) | |
tree | 4ee753ea4cf30287cca8a61f5f329e1d6d442cb3 /mesonbuild/cmake/interpreter.py | |
parent | 7db49db67d4aa7582cf46feb7157235e66aa95b1 (diff) | |
parent | f16149cc4985fc1b35bf7b9435de9b9f52431175 (diff) | |
download | meson-461cb7d5345d6811547d121078dcb26af9310a35.zip meson-461cb7d5345d6811547d121078dcb26af9310a35.tar.gz meson-461cb7d5345d6811547d121078dcb26af9310a35.tar.bz2 |
Merge pull request #7527 from mensinda/cnFixExe
cmake: resolve IMPORTED executables in custom commands (fixes #7509)
Diffstat (limited to 'mesonbuild/cmake/interpreter.py')
-rw-r--r-- | mesonbuild/cmake/interpreter.py | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py index f404109..9749c4c 100644 --- a/mesonbuild/cmake/interpreter.py +++ b/mesonbuild/cmake/interpreter.py @@ -651,7 +651,7 @@ class ConverterCustomTarget: def __repr__(self) -> str: return '<{}: {} {}>'.format(self.__class__.__name__, self.name, self.outputs) - def postprocess(self, output_target_map: OutputTargetMap, root_src_dir: str, subdir: str, all_outputs: T.List[str]) -> None: + def postprocess(self, output_target_map: OutputTargetMap, root_src_dir: str, subdir: str, all_outputs: T.List[str], trace: CMakeTraceParser) -> None: # Default the working directory to ${CMAKE_CURRENT_BINARY_DIR} if not self.working_dir: self.working_dir = self.current_bin_dir.as_posix() @@ -694,7 +694,18 @@ class ConverterCustomTarget: if not j: continue target = output_target_map.executable(j) - cmd += [target] if target else [j] + if target: + cmd += [target] + continue + elif j in trace.targets: + trace_tgt = trace.targets[j] + if trace_tgt.type == 'EXECUTABLE' and 'IMPORTED_LOCATION' in trace_tgt.properties: + cmd += trace_tgt.properties['IMPORTED_LOCATION'] + continue + mlog.debug('CMake: Found invalid CMake target "{}" --> ignoring \n{}'.format(j, trace_tgt)) + + # Fallthrough on error + cmd += [j] commands += [cmd] self.command = commands @@ -969,7 +980,7 @@ class CMakeInterpreter: object_libs = [] custom_target_outputs = [] # type: T.List[str] for i in self.custom_targets: - i.postprocess(self.output_target_map, self.src_dir, self.subdir, custom_target_outputs) + i.postprocess(self.output_target_map, self.src_dir, self.subdir, custom_target_outputs, self.trace) for i in self.targets: i.postprocess(self.output_target_map, self.src_dir, self.subdir, self.install_prefix, self.trace) if i.type == 'OBJECT_LIBRARY': |