Skip to content

Commit 8c2b78c

Browse files
committed
Default Config
1 parent d09209c commit 8c2b78c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

cppython/plugins/cmake/resolution.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ def resolve_cmake_data(data: dict[str, Any], core_data: CorePluginData) -> CMake
2828
# If the user hasn't specified a preset file, we need to create one
2929
if not modified_preset_dir.exists():
3030
modified_preset_dir.parent.mkdir(parents=True, exist_ok=True)
31+
presets_string = CMakePresets().model_dump_json(exclude_none=True)
32+
3133
with modified_preset_dir.open('w', encoding='utf-8') as file:
32-
presets_dict = CMakePresets().model_dump_json(exclude_none=True)
33-
file.write(presets_dict)
34+
file.write(presets_string)
3435

3536
return CMakeData(preset_file=modified_preset_dir, configuration_name=parsed_data.configuration_name)

cppython/plugins/cmake/schema.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ConfigurePreset(CPPythonModel, extra='allow'):
4747
"""Partial Configure Preset specification to allow cache variable injection"""
4848

4949
name: str
50-
cacheVariables: dict[str, None | bool | str | CacheVariable] | None
50+
cacheVariables: dict[str, None | bool | str | CacheVariable] | None = None
5151

5252

5353
class CMakePresets(CPPythonModel, extra='allow'):
@@ -57,7 +57,9 @@ class CMakePresets(CPPythonModel, extra='allow'):
5757
"""
5858

5959
version: Annotated[int, Field(description='The version of the JSON schema.')] = 9
60-
configurePresets: Annotated[list[ConfigurePreset], Field(description='The list of configure presets')] = []
60+
configurePresets: Annotated[list[ConfigurePreset], Field(description='The list of configure presets')] = [
61+
ConfigurePreset(name='default')
62+
]
6163

6264

6365
class CMakeSyncData(SyncData):

0 commit comments

Comments
 (0)