能否在 xmake.lua 或 xmake.conf 中配置生成 compile_commands.json #2834
Answered
by
waruqi
zchrissirhcz
asked this question in
Q&A
Replies: 1 comment 1 reply
-
target("test")
set_kind("binary")
add_files("src/*.cpp")
after_build(function (target)
import("core.base.task")
task.run("project", {kind = "compile_commands", outputdir = "build"})
end) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
zchrissirhcz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
compile_commands.json 搭配 clangd 能够让 vscode 里的 c++ 代码正确跳转、不显示“下画波浪线”。
比较习惯使用命令行进行编译连接等步骤,不太想尝试 xmake 的 vscode 插件。
目前知道的生成 compile_commands.json 的命令:
而如果是 CMake, 可以在
CMakeLists.txt
中设置set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
, 或设置环境变量export CMAKE_EXPORT_COMPILE_COMMANDS=1
, 使得默认生成compile_commands.json
文件。能否在 xmake.lua 或 xmake.conf 中配置生成 compile_commands.json 呢?即:对于新建的c/c++工程,希望只需要输入
Beta Was this translation helpful? Give feedback.
All reactions