From c09cab35386b9c62651f99f8c71242ca0ee1f072 Mon Sep 17 00:00:00 2001 From: "Joshua A. Anderson" Date: Thu, 19 Sep 2024 12:54:31 -0400 Subject: [PATCH] Automatically create compile-commands.json --- .gitignore | 6 +++++- CMakeLists.txt | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 60617624..cf609b9d 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,10 @@ __pycache__ devdoc build -.cache *.pyc .pytest_cache + +# clangd +.clangd +.cache +compile_commands.json diff --git a/CMakeLists.txt b/CMakeLists.txt index 643793e2..df6910da 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -135,3 +135,13 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/extern/random123/include) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/extern/random123/examples) add_subdirectory(fresnel) + +# enable compile_commands.json +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +if (NOT WIN32) + file(CREATE_LINK + "${CMAKE_BINARY_DIR}/compile_commands.json" + "${CMAKE_SOURCE_DIR}/compile_commands.json" + SYMBOLIC + ) +endif()