Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added compile_commands.json #170

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

barakdiker123
Copy link

For using clangd we need the compile
database of compile_commands.json
I think It would be a nice addition for this repo

For using clangd we need the compile
database of compile_commands.json
@wujiang
Copy link

wujiang commented Jun 7, 2023

Love the idea! But I think it's better to add that line in tools.cmake.

--- a/cmake/tools.cmake
+++ b/cmake/tools.cmake
@@ -6,6 +6,8 @@ if(NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
   return()
 endif()

+set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
+
 include(${CMAKE_CURRENT_LIST_DIR}/CPM.cmake)

Copy link
Owner

@TheLartians TheLartians left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! I also enable CMAKE_EXPORT_COMPILE_COMMANDS when developing my projects, though usually set it as a command line option to not mess with project files as different users may have different requirements.

Maybe instead of setting the option in the base project files, add it to all/CmakeLists.txt as that subdirectory exists only for development purposes?

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.

3 participants