diff options
| author | ruki <[email protected]> | 2025-08-16 08:57:56 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-16 08:57:56 +0800 |
| commit | c0f722557a032f969e89d130d35af795f8fdd81e (patch) | |
| tree | 51b1c3f34042f0c11e79cbd76ba080d62e2b12ca /xmake/plugins | |
| parent | a8682bee4c2312c30f1d05fca9d2e670a2eb674c (diff) | |
| parent | 4619d4129f86ecf009b49b0d5d1c8147b1695d6e (diff) | |
Merge pull request #6718 from xmake-io/clangd
ignore pch flags #6710
Diffstat (limited to 'xmake/plugins')
| -rw-r--r-- | xmake/plugins/project/clang/compile_commands.lua | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/xmake/plugins/project/clang/compile_commands.lua b/xmake/plugins/project/clang/compile_commands.lua index 21b086a15..2fed079f1 100644 --- a/xmake/plugins/project/clang/compile_commands.lua +++ b/xmake/plugins/project/clang/compile_commands.lua @@ -140,6 +140,11 @@ function _translate_arguments(arguments) if arg == "-I" then is_include = true end + -- ignore pch flags + -- https://github.com/xmake-io/xmake/issues/6710 + if arg == "-include-pch" or arg:endswith(".pch") then + arg = nil + end if arg then -- improve to support for "/usr/bin/xcrun -sdk macosx clang" -- @see @@ -264,13 +269,6 @@ function _add_target(jsonfile, target) -- enter package environments local oldenvs = os.addenvs(target:pkgenvs()) - -- we enable it for clangd, @see https://github.com/xmake-io/xmake/issues/2818 - local lsp = _get_lsp() - if not lsp or lsp ~= "clangd" then - target:set("pcheader", nil) - target:set("pcxxheader", nil) - end - -- add target commands _add_target_commands(jsonfile, target) @@ -310,7 +308,6 @@ function make(outputdir) local oldir = os.cd(os.projectdir()) local jsonfile = io.open(path.join(outputdir, "compile_commands.json"), "w") os.setenv("XMAKE_IN_COMPILE_COMMANDS_PROJECT_GENERATOR", "true") - target_cmds.prepare_targets() _add_targets(jsonfile) jsonfile:close() os.setenv("XMAKE_IN_COMPILE_COMMANDS_PROJECT_GENERATOR", nil) |
