From d03b0b804e8bb4606d43b2c303e706b5acdc45f9 Mon Sep 17 00:00:00 2001 From: ElnuDev Date: Wed, 9 Mar 2022 11:57:33 -0800 Subject: [PATCH] Export CMake compile commands for clangd --- .gitignore | 1 + CMakeLists.txt | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1998c29 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.cache \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 1bf6509..7791d62 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,3 +12,7 @@ target_include_directories(${ProjectName} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/inc find_package(SFML 2.5 COMPONENTS system window graphics network audio REQUIRED) target_link_libraries(${ProjectName} sfml-graphics) + +# Generates compile_commands.json in build folder, which clangd will pick up +# Without this, clangd might assume the wrong C++ version +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) \ No newline at end of file