From 5f419b4a8628358125ae2a8a8b86682bef9fa3d3 Mon Sep 17 00:00:00 2001 From: Giovanni Fregonese Date: Wed, 14 Feb 2024 11:29:32 +0100 Subject: [PATCH 1/6] Add .vscode/settings.json with compile commands --- .vscode/settings.json | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..774068776 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "C_Cpp.default.compileCommands": "${workspaceFolder}/build/merged_compile_commands.json", + "cmake.mergedCompileCommands": "${workspaceFolder}/build/merged_compile_commands.json" +} From 4e87431cb8b29b0e117a97635450c0f87f5b987b Mon Sep 17 00:00:00 2001 From: Giovanni Fregonese Date: Wed, 14 Feb 2024 11:30:47 +0100 Subject: [PATCH 2/6] Enable CMAKE_EXPORT_COMPILE_COMMANDS option --- cmake/RobotologySuperbuildOptions.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/RobotologySuperbuildOptions.cmake b/cmake/RobotologySuperbuildOptions.cmake index b53ae155e..784d6851a 100644 --- a/cmake/RobotologySuperbuildOptions.cmake +++ b/cmake/RobotologySuperbuildOptions.cmake @@ -3,6 +3,8 @@ set(YCM_USE_CMAKE_PROPOSED TRUE CACHE BOOL "Use files including unmerged cmake patches") +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + # YCM options option(YCM_DISABLE_SYSTEM_PACKAGES "Disable use of all the system installed packages" ON) From f8c5f5b95091eab0c253c5d2a66d0fc485ebdb91 Mon Sep 17 00:00:00 2001 From: Giovanni Fregonese Date: Wed, 14 Feb 2024 12:35:07 +0100 Subject: [PATCH 3/6] Update compile commands paths in .vscode/settings.json to use the set cmake build directory --- .vscode/settings.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 774068776..ae3110950 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,4 @@ { - "C_Cpp.default.compileCommands": "${workspaceFolder}/build/merged_compile_commands.json", - "cmake.mergedCompileCommands": "${workspaceFolder}/build/merged_compile_commands.json" + "C_Cpp.default.compileCommands": "${config:cmake.buildDirectory}/compile_commands.json", + "cmake.mergedCompileCommands": "${config:cmake.buildDirectory}/compile_commands.json", } From 0b7e964668bff20ff6ebf208881397c350d3cd5d Mon Sep 17 00:00:00 2001 From: Giovanni Fregonese Date: Wed, 14 Feb 2024 12:35:14 +0100 Subject: [PATCH 4/6] Add clangd arguments to .vscode/settings.json --- .vscode/settings.json | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index ae3110950..890d8914a 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,7 @@ { "C_Cpp.default.compileCommands": "${config:cmake.buildDirectory}/compile_commands.json", "cmake.mergedCompileCommands": "${config:cmake.buildDirectory}/compile_commands.json", + "clangd.arguments": [ + "--compile-commands-dir=${config:cmake.buildDirectory}/" + ], } From 2e4659beb1e29ed3d965c2c22337ebe8d1afb06e Mon Sep 17 00:00:00 2001 From: Giovanni Fregonese Date: Wed, 14 Feb 2024 12:41:39 +0100 Subject: [PATCH 5/6] Set the CMAKE_EXPORT_COMPILE_COMMANDS as option Co-authored-by: Silvio Traversaro --- cmake/RobotologySuperbuildOptions.cmake | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmake/RobotologySuperbuildOptions.cmake b/cmake/RobotologySuperbuildOptions.cmake index 784d6851a..94a75adad 100644 --- a/cmake/RobotologySuperbuildOptions.cmake +++ b/cmake/RobotologySuperbuildOptions.cmake @@ -3,7 +3,10 @@ set(YCM_USE_CMAKE_PROPOSED TRUE CACHE BOOL "Use files including unmerged cmake patches") -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + set(CMAKE_EXPORT_COMPILE_COMMANDS "ON" + CACHE BOOL "Enable/Disable output of compile commands during generation." + ) + mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS) # YCM options option(YCM_DISABLE_SYSTEM_PACKAGES "Disable use of all the system installed packages" ON) From ed51b556baed37a70298d88beb9e74fc3f4c19d4 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Wed, 14 Feb 2024 13:22:44 +0100 Subject: [PATCH 6/6] Update RobotologySuperbuildOptions.cmake --- cmake/RobotologySuperbuildOptions.cmake | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/cmake/RobotologySuperbuildOptions.cmake b/cmake/RobotologySuperbuildOptions.cmake index 94a75adad..607d0574a 100644 --- a/cmake/RobotologySuperbuildOptions.cmake +++ b/cmake/RobotologySuperbuildOptions.cmake @@ -3,10 +3,8 @@ set(YCM_USE_CMAKE_PROPOSED TRUE CACHE BOOL "Use files including unmerged cmake patches") - set(CMAKE_EXPORT_COMPILE_COMMANDS "ON" - CACHE BOOL "Enable/Disable output of compile commands during generation." - ) - mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "Enable/Disable output of compile commands during generation.") +mark_as_advanced(CMAKE_EXPORT_COMPILE_COMMANDS) # YCM options option(YCM_DISABLE_SYSTEM_PACKAGES "Disable use of all the system installed packages" ON)