Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions cppython/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ def write_generator_presets(path: Path, generator_name: str, toolchain_path: Pat

def write_root_presets(self, path: Path):
"""
Read the top level json file and replace the include reference
Read the top level json file and replace the include reference.
Receives a relative path to the tool cmake json file
"""

root_preset_path = self.configuration.root_path / "CMakePresets.json"
Expand All @@ -172,7 +173,7 @@ def write_root_presets(self, path: Path):
if root_model.include is not None:
for index, include_path in enumerate(root_model.include):
if Path(include_path).name == "cppython.json":
root_model.include[index] = path.as_posix()
root_model.include[index] = "${sourceDir}/build" + path.as_posix()

# 'dict.update' wont apply to nested types, manual replacement
root_preset["include"] = root_model.include
Expand Down Expand Up @@ -341,7 +342,7 @@ def install(self) -> None:
raise exception

project_presets = self._builder.write_presets(preset_path, generator_output)
self._builder.write_root_presets(project_presets)
self._builder.write_root_presets(project_presets.relative_to(preset_path))

def update(self) -> None:
"""
Expand Down Expand Up @@ -372,4 +373,4 @@ def update(self) -> None:
raise exception

project_presets = self._builder.write_presets(preset_path, generator_output)
self._builder.write_root_presets(project_presets)
self._builder.write_root_presets(project_presets.relative_to(preset_path))