From 959c616f054384bb0e664e4e725ecb9ff26e4fb0 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Mon, 5 Aug 2024 12:42:20 -0400 Subject: [PATCH] add_source_file: Fix failure to add Boost unit tests to Xcode --- add_source_file | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/add_source_file b/add_source_file index 8cec7a9d641..a5f81a03a52 100755 --- a/add_source_file +++ b/add_source_file @@ -103,12 +103,18 @@ def add_to_xcode(filename, targets): f"Could not find target '{tname}' in Xcode project file") # groups are organized by directory structure under "src" - src_groups = project.get_groups_by_name("src") + # except for tests, which have a separate root, "tests" + if pathlib.Path("tests") in filename.parents: + src_groups = project.get_groups_by_name("tests") + else: + src_groups = project.get_groups_by_name("src") if len(src_groups) != 1: raise Exception("problem finding 'src' group in xcode project") src_group = src_groups[0] parent_group = src_group for d in filename.parts[:-1]: + if d == "tests": + continue found_groups = project.get_groups_by_name(d, parent=parent_group) if len(found_groups) != 1: groupname = parent_group.get_name()