From ef02a377729f5aaa9588fd4de4c79c6bfa23d1ab Mon Sep 17 00:00:00 2001 From: Asher Norland Date: Tue, 24 May 2022 06:18:41 -0400 Subject: [PATCH] Relative Root Preset Reference --- cppython/project.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cppython/project.py b/cppython/project.py index 52a6111..ba5fc7e 100644 --- a/cppython/project.py +++ b/cppython/project.py @@ -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" @@ -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 @@ -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: """ @@ -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))