Enable clangd support. (#8104)

* Enable clangd support.

* Disable CMAKE_EXPORT_COMPILE_COMMANDS by default.

* Revert unwanted target rename.
This commit is contained in:
MarcelPiNacy-CVC 2024-09-03 13:19:20 +02:00 committed by GitHub
parent aa9d95eb21
commit 908c203fca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 0 deletions

2
.clangd.in Normal file
View File

@ -0,0 +1,2 @@
CompileFlags:
CompilationDatabase: "@CMAKE_CURRENT_BINARY_DIR@"

View File

@ -18,6 +18,7 @@ cmake_policy (SET CMP0091 NEW)
cmake_policy (SET CMP0074 NEW) cmake_policy (SET CMP0074 NEW)
cmake_policy (SET CMP0077 NEW) cmake_policy (SET CMP0077 NEW)
cmake_policy (SET CMP0117 NEW) cmake_policy (SET CMP0117 NEW)
if (${CMAKE_MINOR_VERSION} GREATER_EQUAL 24) if (${CMAKE_MINOR_VERSION} GREATER_EQUAL 24)
cmake_policy (SET CMP0135 NEW) cmake_policy (SET CMP0135 NEW)
endif () endif ()
@ -121,3 +122,10 @@ file (
${CMAKE_CURRENT_BINARY_DIR}/Help.md ${CMAKE_CURRENT_BINARY_DIR}/Help.md
${CARLA_CMAKE_HELP_MESSAGE} ${CARLA_CMAKE_HELP_MESSAGE}
) )
if (CMAKE_EXPORT_COMPILE_COMMANDS)
configure_file (
${CARLA_WORKSPACE_PATH}/.clangd.in
${CARLA_WORKSPACE_PATH}/.clangd
)
endif ()