Skip to content

Commit 4124a9a

Browse files
authored
(vscode + cmake) Add option MBED_GENERATE_VSCODE_CONFIG (ARMmbed#142)
1 parent 823e795 commit 4124a9a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tools/cmake/mbed_ide_debug_cfg_generator.cmake

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33

44
# Script to automatically generate debug configurations for various IDEs.
55

6+
# Options
7+
# -------------------------------------------------------------
8+
option(MBED_GENERATE_VSCODE_CONFIG "If TRUE, Mbed will generate launch.json and tasks.json files allowing you to flash and debug code from the IDE" TRUE)
9+
10+
611
# Detect IDEs
712
# -------------------------------------------------------------
813

@@ -16,7 +21,7 @@ if("$ENV{CLION_IDE}" AND MBED_UPLOAD_SUPPORTS_DEBUG)
1621
message(FATAL_ERROR "In order to generate CLion configuration files, Mbed CE needs to know the name of the current CLion build profile. This name is the string typed into the Name textbox under Settings > Build, Execution, Deployment > CMake. Pass this name with '-DMBED_CLION_PROFILE_NAME=<name>'.")
1722
endif()
1823

19-
elseif(CMAKE_EXPORT_COMPILE_COMMANDS AND MBED_UPLOAD_SUPPORTS_DEBUG) # TODO: Is this actually a reliable way of detecting VS Code? Not sure if it will create false positives.
24+
elseif(CMAKE_EXPORT_COMPILE_COMMANDS AND MBED_UPLOAD_SUPPORTS_DEBUG AND MBED_GENERATE_VSCODE_CONFIG) # TODO: Is this actually a reliable way of detecting VS Code? Not sure if it will create false positives.
2025
message(STATUS "Mbed: Detected VS Code IDE, will generate VS Code debug configurations")
2126
set(MBED_GENERATE_VS_CODE_DEBUG_CFGS TRUE)
2227

@@ -171,14 +176,14 @@ elseif(MBED_GENERATE_VS_CODE_DEBUG_CFGS)
171176
get_property(VSCODE_LAUNCH_JSON_CONTENT GLOBAL PROPERTY VSCODE_LAUNCH_JSON_CONTENT)
172177
file(GENERATE OUTPUT ${VSCODE_LAUNCH_JSON_PATH} CONTENT ${VSCODE_LAUNCH_JSON_CONTENT})
173178

174-
179+
175180
# Convert the CMake list into the correct format for tasks.json
176181
list(GET MBED_UPLOAD_GDBSERVER_DEBUG_COMMAND 0 GDBSERVER_EXECUTABLE)
177182
list(SUBLIST MBED_UPLOAD_GDBSERVER_DEBUG_COMMAND 1 -1 GDBSERVER_ARGS)
178183
set(GDBSERVER_ARGS_STR "")
179184
set(IS_FIRST_ARG TRUE)
180185
foreach(ELEMENT ${GDBSERVER_ARGS})
181-
186+
182187
if(IS_FIRST_ARG)
183188
set(IS_FIRST_ARG FALSE)
184189
else()
@@ -284,4 +289,4 @@ else()
284289
function(mbed_finalize_ide_debug_configurations)
285290
endfunction()
286291

287-
endif()
292+
endif()

0 commit comments

Comments
 (0)