diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2020-02-05 19:44:22 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-05 19:44:22 +0200 |
commit | 91ee0d1405989bcffc44bbcf5132889aa400c2c6 (patch) | |
tree | e94dde8408f638b4a1f3449cd408b180b7095c9a /mesonbuild/cmake/traceparser.py | |
parent | 4c5a9523be202ad8793afd23635a66cf6501af16 (diff) | |
parent | 379f3d899530111a082dd586c5b0e8a825cdcf63 (diff) | |
download | meson-91ee0d1405989bcffc44bbcf5132889aa400c2c6.zip meson-91ee0d1405989bcffc44bbcf5132889aa400c2c6.tar.gz meson-91ee0d1405989bcffc44bbcf5132889aa400c2c6.tar.bz2 |
Merge pull request #6582 from mensinda/cmQuotes
cmake: Fix spaces in compile flags (fixes #6566)
Diffstat (limited to 'mesonbuild/cmake/traceparser.py')
-rw-r--r-- | mesonbuild/cmake/traceparser.py | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/mesonbuild/cmake/traceparser.py b/mesonbuild/cmake/traceparser.py index 5bf9547..4aa34f1 100644 --- a/mesonbuild/cmake/traceparser.py +++ b/mesonbuild/cmake/traceparser.py @@ -54,6 +54,13 @@ class CMakeTarget: propSTR += " '{}': {}\n".format(i, self.properties[i]) return s.format(self.name, self.type, self.imported, propSTR, self.tline) + def strip_properties(self) -> None: + # Strip the strings in the properties + if not self.properties: + return + for key, val in self.properties.items(): + self.properties[key] = [x.strip() for x in val] + class CMakeGeneratorTarget(CMakeTarget): def __init__(self, name): super().__init__(name, 'CUSTOM', {}) @@ -63,11 +70,8 @@ class CMakeGeneratorTarget(CMakeTarget): class CMakeTraceParser: def __init__(self, cmake_version: str, build_dir: str, permissive: bool = False): - # Dict of CMake variables: '<var_name>': ['list', 'of', 'values'] - self.vars = {} - - # Dict of CMakeTarget - self.targets = {} + self.vars = {} # type: T.Dict[str, T.List[str]] + self.targets = {} # type: T.Dict[str, CMakeTarget] # T.List of targes that were added with add_custom_command to generate files self.custom_targets = [] # type: T.List[CMakeGeneratorTarget] @@ -133,6 +137,10 @@ class CMakeTraceParser: if(fn): fn(l) + # Postprocess + for tgt in self.targets.values(): + tgt.strip_properties() + def get_first_cmake_var_of(self, var_list: T.List[str]) -> T.List[str]: # Return the first found CMake variable in list var_list for i in var_list: |