blob: 4c18627a57a803d38003a3a744bc7d5fd6d79a20 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
local overseer = require('overseer')
local root_pattern = require('lspconfig/util').root_pattern('CMakePresets.json', 'CTestConfig.cmake', 'build', 'cmake')
return {
name = 'Build Cmake Project',
builder = function(_)
local filename = vim.fn.expand('%:p')
local root_dir = root_pattern(filename) or vim.fn.getcwd()
local args = vim.g.overseer_cmake_extra_args or ''
return {
name = 'Cmake',
cmd = 'cmake ' .. args .. '.. && cmake --build .',
cwd = root_dir .. '/build',
}
end,
tags = { overseer.TAG.BUILD },
priority = 40,
condition = {
callback = function()
local filename = vim.fn.expand('%:p')
local root_dir = root_pattern(filename)
return root_dir ~= nil
end,
},
}
|