only run when cmake available

This commit is contained in:
Oliver Hartmann 2022-11-30 21:19:22 +01:00
parent 2ff32c06fd
commit e93e47bd69
4 changed files with 34 additions and 0 deletions

View File

@ -9,4 +9,15 @@ return {
cwd = 'build_nvim', cwd = 'build_nvim',
} }
end, end,
condition = {
callback = function(opts)
if vim.fn.executable("cmake") == 0 then
return false, 'Command "cmake" not found'
end
if vim.fn.findfile("CMakeLists.txt", opts.dir .. ";") == "" then
return false, "No CMakeLists.txt found"
end
return true
end,
},
} }

View File

@ -9,4 +9,15 @@ return {
cwd = 'build_nvim', cwd = 'build_nvim',
} }
end, end,
condition = {
callback = function(opts)
if vim.fn.executable("cmake") == 0 then
return false, 'Command "cmake" not found'
end
if vim.fn.findfile("CMakeLists.txt", opts.dir .. ";") == "" then
return false, "No CMakeLists.txt found"
end
return true
end,
},
} }

View File

@ -1,4 +1,5 @@
return { return {
'builtin',
'user.cmake.configure', 'user.cmake.configure',
'user.cmake.build', 'user.cmake.build',
'user.cmake.clean'} 'user.cmake.clean'}

View File

@ -10,4 +10,15 @@ return {
cwd = build_nvim, cwd = build_nvim,
} }
end, end,
condition = {
callback = function(opts)
if vim.fn.executable("cmake") == 0 then
return false, 'Command "cmake" not found'
end
if vim.fn.findfile("CMakeLists.txt", opts.dir .. ";") == "" then
return false, "No CMakeLists.txt found"
end
return true
end,
},
} }