@@ -115,12 +115,18 @@ function cmake.generate(opt, callback)
115115 if presets_exists then
116116 local presets = Presets :parse (config .cwd )
117117
118+ local find_preset = false
118119 -- Refresh build type to use from CMakePresets
119120 if config .configure_preset then
120- config .build_type = presets :get_configure_preset (config .configure_preset ):get_build_type ()
121+ local configure_preset =
122+ presets :get_configure_preset (config .configure_preset , { include_hidden = true })
123+ if configure_preset then
124+ find_preset = true
125+ config .build_type = configure_preset :get_build_type ()
126+ end
121127 end
122128
123- if not config .configure_preset then
129+ if ( not config .configure_preset ) or ( find_preset == false ) then
124130 -- try to determine the confiure preset based on the build preset
125131 if config .build_preset then
126132 local build_preset = presets :get_build_preset (config .build_preset )
@@ -133,7 +139,7 @@ function cmake.generate(opt, callback)
133139 end
134140 end
135141
136- if not config .configure_preset then
142+ if ( not config .configure_preset ) or ( find_preset == false ) then
137143 -- this will also set value for build type from preset.
138144 -- default to be "Debug"
139145 return cmake .select_configure_preset (function (result )
@@ -147,7 +153,7 @@ function cmake.generate(opt, callback)
147153 return
148154 end
149155
150- if config .configure_preset then
156+ if config .configure_preset and find_preset then
151157 -- if exsist preset file and set configure preset, then
152158 -- set build directory to the `binaryDir` option of `configurePresets`
153159 local preset = presets :get_configure_preset (config .configure_preset )
0 commit comments