@@ -19,14 +19,18 @@ def __init__(self) -> None:
1919
2020 @staticmethod
2121 def generate_cppython_preset (
22- cppython_preset_directory : Path , provider_preset_file : Path , provider_data : CMakeSyncData
22+ cppython_preset_directory : Path ,
23+ provider_preset_file : Path ,
24+ provider_data : CMakeSyncData ,
25+ project_root : Path ,
2326 ) -> CMakePresets :
2427 """Generates the cppython preset which inherits from the provider presets
2528
2629 Args:
2730 cppython_preset_directory: The tool directory
2831 provider_preset_file: Path to the provider's preset file
2932 provider_data: The provider's synchronization data
33+ project_root: The project root directory (where CMakeLists.txt is located)
3034
3135 Returns:
3236 A CMakePresets object
@@ -43,7 +47,8 @@ def generate_cppython_preset(
4347 )
4448
4549 if provider_data .toolchain_file :
46- default_configure .toolchainFile = provider_data .toolchain_file .as_posix ()
50+ relative_toolchain = provider_data .toolchain_file .relative_to (project_root , walk_up = True )
51+ default_configure .toolchainFile = relative_toolchain .as_posix ()
4752
4853 configure_presets .append (default_configure )
4954
@@ -55,20 +60,24 @@ def generate_cppython_preset(
5560
5661 @staticmethod
5762 def write_cppython_preset (
58- cppython_preset_directory : Path , provider_preset_file : Path , provider_data : CMakeSyncData
63+ cppython_preset_directory : Path ,
64+ provider_preset_file : Path ,
65+ provider_data : CMakeSyncData ,
66+ project_root : Path ,
5967 ) -> Path :
6068 """Write the cppython presets which inherit from the provider presets
6169
6270 Args:
6371 cppython_preset_directory: The tool directory
6472 provider_preset_file: Path to the provider's preset file
6573 provider_data: The provider's synchronization data
74+ project_root: The project root directory (where CMakeLists.txt is located)
6675
6776 Returns:
6877 A file path to the written data
6978 """
7079 generated_preset = Builder .generate_cppython_preset (
71- cppython_preset_directory , provider_preset_file , provider_data
80+ cppython_preset_directory , provider_preset_file , provider_data , project_root
7281 )
7382 cppython_preset_file = cppython_preset_directory / 'cppython.json'
7483
0 commit comments