Skip to content

Fix exportCompileCommands flag handling#4899

Open
hanniavalera wants to merge 2 commits intomainfrom
dev/hanniavalera/stopArgCmakePreset
Open

Fix exportCompileCommands flag handling#4899
hanniavalera wants to merge 2 commits intomainfrom
dev/hanniavalera/stopArgCmakePreset

Conversation

@hanniavalera
Copy link
Copy Markdown
Contributor

This pull request addresses a bug related to the handling of the cmake.exportCompileCommandsFile setting, ensuring that when it is set to false, the -DCMAKE_EXPORT_COMPILE_COMMANDS flag is omitted entirely rather than being passed as FALSE. This prevents CMake warnings for projects configured with LANGUAGES NONE. The changes also add targeted unit tests to validate the new logic. Resolves #4893 and tied to #4681

Bug Fixes and Logic Improvements:

  • Updated the logic in CMakeDriver (cmakeDriver.ts) so that the -DCMAKE_EXPORT_COMPILE_COMMANDS flag is only injected if cmake.exportCompileCommandsFile is true or unset, and omitted entirely if false, both for presets and kits modes. This resolves warnings in certain CMake projects. [1] [2]
  • Added a new unit test suite (exportCompileCommands.test.ts) to verify the correct behavior for all combinations of the setting and argument overrides, ensuring the bug is fixed and future regressions are caught.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Stop add -DCMAKE_EXPORT_COMPILE_COMMANDS if using cmake preset

1 participant