Skip to content

Commit 1d96327

Browse files
authored
Add support for CMAKE_BUILD_TYPE presets using "type"/"value" form. (#297)
* Add support for CMAKE_BUILD_TYPE presets using "type"/"value" form. With the current implementation, if CMakePresets.json sets CMAKE_BUILD_TYPE as an JSON object with a "type" and "value" causes the build step to fail -- example below. ```json "CMAKE_BUILD_TYPE": { "type": "STRING", "value": "Debug" } ``` This fix looks for a CMAKE_BUILD_TYPE with a "table" type and extracts the "value" element, otherwise it falls back to the original behavior. * Refactor to expand all cacheVariable in type/value form * Had a rethink about this -- this will ensure expansion of vars in 'value' * Use . syntax
1 parent 72a5eb8 commit 1d96327

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

lua/cmake-tools/preset.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ local osys = require("cmake-tools.osys")
44
local Preset = {}
55

66
local function expandMacro(self, str)
7+
if type(str) == "table" and str.value ~= nil then
8+
str = str.value
9+
end
10+
711
if type(str) ~= "string" then
812
return str
913
end

0 commit comments

Comments
 (0)