File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -21,7 +21,8 @@ local const = {
2121 -- copy: this will automatically copy compile commands file to target
2222 -- lsp: this will automatically set compile commands file location using lsp
2323 -- none: this will make this option ignored
24- target = vim .loop .cwd (), -- path to directory, this is used only if action == "soft_link" or action == "copy"
24+ --- @type string | fun (): string
25+ target = vim .loop .cwd , -- path or function returning path to directory, this is used only if action == "soft_link" or action == "copy"
2526 },
2627 cmake_kits_path = nil , -- this is used to specify global cmake kits path, see CMakeKits for detailed usage
2728 cmake_variants_message = {
Original file line number Diff line number Diff line change @@ -1482,7 +1482,11 @@ function cmake.copy_compile_commands()
14821482 end
14831483
14841484 local source = config :build_directory_path () .. " /compile_commands.json"
1485- local destination = const .cmake_compile_commands_options .target .. " /compile_commands.json"
1485+ local target = const .cmake_compile_commands_options .target
1486+ if type (target ) == " function" then
1487+ target = target ()
1488+ end
1489+ local destination = target .. " /compile_commands.json"
14861490 utils .copyfile (source , destination )
14871491end
14881492
@@ -1492,7 +1496,11 @@ function cmake.compile_commands_from_soft_link()
14921496 end
14931497
14941498 local source = config :build_directory_path () .. " /compile_commands.json"
1495- local destination = const .cmake_compile_commands_options .target .. " /compile_commands.json"
1499+ local target = const .cmake_compile_commands_options .target
1500+ if type (target ) == " function" then
1501+ target = target ()
1502+ end
1503+ local destination = target .. " /compile_commands.json"
14961504 utils .softlink (source , destination )
14971505end
14981506
You can’t perform that action at this time.
0 commit comments