# vscode-cmaketools-template **Repository Path**: leoZhangs/vscode-cmaketools-template ## Basic Information - **Project Name**: vscode-cmaketools-template - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-04-01 - **Last Updated**: 2025-07-31 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # VSCode + CMakeTools 1. Install the vscode-cmake-tools extension 2. Install the MS C++ extension 3. Create launch.json for debugging and running ``` json { "name": "QtTest-debug", "type": "cppvsdbg", "request": "launch", "program": "${workspaceFolder}/build/local-debug/bin/QtTest.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [ { "name": "PATH", "value": "C:/sdk/bin;C:/sdk/glog/glog-0.5.0/bin;C:/sdk/libiconv/x64-Release/bin;C:/sdk/gdal/bin;C:/sdk/Qt/Qt5.12.8/msvc2017_64/bin;E:/VisualizeDemo/DataAccessor/install/bin;${env.PATH}" }, { "name": "QT_QPA_PLATFORM_PLUGIN_PATH", "value": "C:/sdk/Qt/Qt5.12.8/msvc2017_64/plugins/platforms" } ], "console": "externalTerminal" } ``` 4. Generate compile_commands.json - Can add args parameter in cmake-tools settings - Can add configuration in CMakeLists:```set(CMAKE_EXPORT_COMPILE_COMMANDS ON)``` - Can set in cacheVariables of CMakePresets.json:```"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"``` 5. Set compile_commands.json copy path in settings.json ``` json { "files.associations": { ".tpp": "C++", }, "cmake.generator": "ninja", "cmake.copyCompileCommands": "${workspaceFolder}/compile_commands.json", "cmake.exportCompileCommandsFile": false } ``` 6. Update includePath: compileCommands field in c_cpp_properties.json ``` json { "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "windowsSdkVersion": "10.0.26100.0", "compilerPath": "cl.exe", "intelliSenseMode": "windows-msvc-x64", "cppStandard": "c++17", "cStandard": "c11", "compileCommands":"${workspaceFolder}/compile_commands.json" } ], "version": 4 } ``` ## 注意 - cmake-tools cannot call launch.json for debugging