diff --git a/.gitignore b/.gitignore index 7e8820fd6..b44ff01f4 100644 --- a/.gitignore +++ b/.gitignore @@ -45,6 +45,9 @@ cmake-build-*/ .kdev?/ *.kdev? +# clangd LSP files +**.cache/clangd + # File-based project format: *.iws diff --git a/CMakeLists.txt b/CMakeLists.txt index 6366a5ce6..2edb41be6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,14 @@ cmake_minimum_required(VERSION 3.20.0) project(ImpactX VERSION 23.06) +# generate compile_commands.json +if(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles" OR ${CMAKE_GENERATOR} STREQUAL + "Ninja") + if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + endif() +endif() + include(${ImpactX_SOURCE_DIR}/cmake/ImpactXFunctions.cmake) # In-source tree builds are messy and can screw up the build system.