summaryrefslogtreecommitdiff
path: root/mesonbuild/backend/xcodebackend.py
diff options
context:
space:
mode:
authorNick <0xb000@gmail.com>2024-11-04 18:33:41 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2024-12-16 02:14:15 +0200
commit0b41b364be716064285928c00330d1fc6b07cd88 (patch)
tree92509e086c65b97d02faaee1fde7c39f452547b3 /mesonbuild/backend/xcodebackend.py
parente542901af6e30865715d3c3c18f703910a096ec0 (diff)
downloadmeson-0b41b364be716064285928c00330d1fc6b07cd88.tar.gz
Xcode backend: better quoting for spaces in HEADER_SEARCH_PATHS
Xcode treats this dict value as a space-separated string, any spaces in the path will make the path invalid by splitting it into pieces. Split out header path processing into a helper function.
Diffstat (limited to 'mesonbuild/backend/xcodebackend.py')
-rw-r--r--mesonbuild/backend/xcodebackend.py22
1 files changed, 12 insertions, 10 deletions
diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py
index 5c03c7157..0e40d0239 100644
--- a/mesonbuild/backend/xcodebackend.py
+++ b/mesonbuild/backend/xcodebackend.py
@@ -1756,19 +1756,12 @@ class XCodeBackend(backends.Backend):
settings_dict.add_item('GCC_PREFIX_HEADER', f'$(PROJECT_DIR)/{relative_pch_path}')
settings_dict.add_item('GCC_PREPROCESSOR_DEFINITIONS', '')
settings_dict.add_item('GCC_SYMBOLS_PRIVATE_EXTERN', 'NO')
- header_arr = PbxArray()
- unquoted_headers = []
- unquoted_headers.append(self.get_target_private_dir_abs(target))
+ unquoted_headers = [self.get_target_private_dir_abs(target)]
if target.implicit_include_directories:
unquoted_headers.append(os.path.join(self.environment.get_build_dir(), target.get_subdir()))
unquoted_headers.append(os.path.join(self.environment.get_source_dir(), target.get_subdir()))
- if headerdirs:
- for i in headerdirs:
- i = os.path.normpath(i)
- unquoted_headers.append(i)
- for i in unquoted_headers:
- header_arr.add_item(f'"{i}"')
- settings_dict.add_item('HEADER_SEARCH_PATHS', header_arr)
+ unquoted_headers += headerdirs
+ settings_dict.add_item('HEADER_SEARCH_PATHS', self.normalize_header_search_paths(unquoted_headers))
settings_dict.add_item('INSTALL_PATH', install_path)
settings_dict.add_item('LIBRARY_SEARCH_PATHS', '')
if isinstance(target, build.SharedModule):
@@ -1796,6 +1789,15 @@ class XCodeBackend(backends.Backend):
warn_array.add_item('"$(inherited)"')
bt_dict.add_item('name', buildtype)
+ def normalize_header_search_paths(self, header_dirs) -> PbxArray:
+ header_arr = PbxArray()
+ for i in header_dirs:
+ np = os.path.normpath(i)
+ # Make sure Xcode will not split single path into separate entries, escaping space with a slash is not enought
+ item = f'"\\\"{np}\\\""' if ' ' in np else f'"{np}"'
+ header_arr.add_item(item)
+ return header_arr
+
def add_otherargs(self, settings_dict, langargs):
for langname, args in langargs.items():
if args: