Tooling: generate compile_commands.json for clangd
The Visual Studio CMake generator does not emit compile_commands.json, so clangd had no include paths or flags and reported hundreds of false errors. Add a parallel Ninja config (build-clangd/) that produces the database: - CMAKE_EXPORT_COMPILE_COMMANDS ON (honored by Ninja, ignored by VS) - gen-compile-commands.bat configures build-clangd/ under vcvars64 - .clangd points clangd's CompilationDatabase at build-clangd/ - ignore /build-clangd clangd's clang-cl driver auto-resolves the MSVC/Windows SDK system includes, so the cl.exe-based database is sufficient. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -13,6 +13,11 @@ set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
# Emit compile_commands.json so clangd resolves includes/flags. Ignored by the
|
||||
# Visual Studio generator, so configure the Ninja build (build-clangd/) for this;
|
||||
# .clangd points clangd at that compilation database.
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# Single output dir keeps the donor-launch / inject workflow simple: host exe and
|
||||
# hook dll land next to each other under /bin (already in .gitignore).
|
||||
set(COOP_OUTPUT_DIR "${CMAKE_SOURCE_DIR}/bin/$<CONFIG>")
|
||||
|
||||
Reference in New Issue
Block a user