Skip to content

Commit a3648be

Browse files
committed
fix: CMakePresets.json file may not exists
1 parent df2f55d commit a3648be

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

lua/cmake-tools/config.lua

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,10 @@ function Config:build_targets_with_sources()
485485
end
486486

487487
function Config:update_build_type()
488+
local presets_exists = self.base_settings.use_preset and Presets.exists(self.cwd)
489+
if not presets_exists then
490+
return
491+
end
488492
local presets = Presets:parse(self.cwd)
489493
if not presets then
490494
return
@@ -530,6 +534,11 @@ function Config:update_build_type()
530534
end
531535

532536
function Config:update_build_target()
537+
local presets_exists = self.base_settings.use_preset and Presets.exists(self.cwd)
538+
if not presets_exists then
539+
return
540+
end
541+
533542
local presets = Presets:parse(self.cwd)
534543
if not presets then
535544
return
@@ -564,6 +573,10 @@ function Config:update_build_directory()
564573
return
565574
end
566575

576+
local presets_exists = self.base_settings.use_preset and Presets.exists(self.cwd)
577+
if not presets_exists then
578+
return
579+
end
567580
local presets = Presets:parse(self.cwd)
568581
if presets then
569582
if not self.configure_preset then

0 commit comments

Comments
 (0)