Skip to content

Commit b744749

Browse files
haikionlceWolf
authored andcommitted
Fix overwriting of default CMake variants
1 parent ec3bc50 commit b744749

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

lua/cmake-tools/variants.lua

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -224,19 +224,14 @@ function variants.build_arglist(variant, cwd)
224224
local function build_simple(build_type)
225225
return { "-D", "CMAKE_BUILD_TYPE:STRING=" .. build_type }
226226
end
227-
228-
-- start building arglist
229-
230-
-- check if the chosen variants is one of the defaults
231-
for _, defaultvar in pairs(DEFAULT_VARIANTS) do
232-
if variant == defaultvar then
233-
return build_simple(variant) -- if so, build the simple arglist and return
234-
end
235-
end
236-
237-
-- otherwise, find the config file to parse
238227
local config = variants.parse(cwd)
239228
if not config then
229+
-- check if the chosen variants is one of the defaults
230+
for _, defaultvar in pairs(DEFAULT_VARIANTS) do
231+
if variant == defaultvar then
232+
return build_simple(variant) -- if so, build the simple arglist and return
233+
end
234+
end
240235
return {} -- silent error (empty arglist) if no config file found
241236
end
242237

0 commit comments

Comments
 (0)