From 908c203fca2fd6c6dc27ec8334630208496664a5 Mon Sep 17 00:00:00 2001 From: MarcelPiNacy-CVC <169088301+MarcelPiNacy-CVC@users.noreply.github.com> Date: Tue, 3 Sep 2024 13:19:20 +0200 Subject: [PATCH] Enable clangd support. (#8104) * Enable clangd support. * Disable CMAKE_EXPORT_COMPILE_COMMANDS by default. * Revert unwanted target rename. --- .clangd.in | 2 ++ CMakeLists.txt | 8 ++++++++ 2 files changed, 10 insertions(+) create mode 100644 .clangd.in diff --git a/.clangd.in b/.clangd.in new file mode 100644 index 000000000..12902db3f --- /dev/null +++ b/.clangd.in @@ -0,0 +1,2 @@ +CompileFlags: + CompilationDatabase: "@CMAKE_CURRENT_BINARY_DIR@" diff --git a/CMakeLists.txt b/CMakeLists.txt index e850e1bba..86f203546 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,6 +18,7 @@ cmake_policy (SET CMP0091 NEW) cmake_policy (SET CMP0074 NEW) cmake_policy (SET CMP0077 NEW) cmake_policy (SET CMP0117 NEW) + if (${CMAKE_MINOR_VERSION} GREATER_EQUAL 24) cmake_policy (SET CMP0135 NEW) endif () @@ -121,3 +122,10 @@ file ( ${CMAKE_CURRENT_BINARY_DIR}/Help.md ${CARLA_CMAKE_HELP_MESSAGE} ) + +if (CMAKE_EXPORT_COMPILE_COMMANDS) + configure_file ( + ${CARLA_WORKSPACE_PATH}/.clangd.in + ${CARLA_WORKSPACE_PATH}/.clangd + ) +endif ()