summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/overseer/template/custom/cmake_build.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/overseer/template/custom/cmake_build.lua')
-rw-r--r--.config/nvim/lua/overseer/template/custom/cmake_build.lua24
1 files changed, 24 insertions, 0 deletions
diff --git a/.config/nvim/lua/overseer/template/custom/cmake_build.lua b/.config/nvim/lua/overseer/template/custom/cmake_build.lua
new file mode 100644
index 0000000..cb321a0
--- /dev/null
+++ b/.config/nvim/lua/overseer/template/custom/cmake_build.lua
@@ -0,0 +1,24 @@
+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()
+
+ return {
+ name = 'Cmake',
+ cmd = 'cmake .. && 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,
+ },
+}