VSCODE-CMAKE工程运行和调试

launch.json

{
    
    
    // 使用 IntelliSense 了解相关属性。 
    // 悬停以查看现有属性的描述。
    // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
    
    
            "name": "g++ - 生成和调试活动文件",
            "type": "cppdbg",
            "request": "launch",
            "program": "${workspaceFolder}/build/app/testCurveFitting",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceFolder}",
            "environment": [],
            "externalConsole": false,
            "MIMode": "gdb",
            "setupCommands": [
                {
    
    
                    "description": "为 gdb 启用整齐打印",
                    "text": "-enable-pretty-printing",
                    "ignoreFailures": true
                }
            ],
             "preLaunchTask": "build",//因为task.json 最后的lable为build ,build依赖于cmake.. make
            "miDebuggerPath": "/usr/bin/gdb"
        }
    ]
}

task.json

{
    
    
    "version": "2.0.0",
    "options": {
    
    
        "cwd": "${workspaceFolder}/build/app"
    },


    "tasks": [
        {
    
    
            "type": "shell",
            "label": "cmake",
            "command": "cmake",
            "args": [
                ".."
            ]          
         },
        {
    
    
                "label": "make",
                "group": {
    
    
                     "kind": "build",
                    "isDefault": true
            },
            "command": "make",
            "args": [
             
            ]          
        },
        {
    
    
            "label": "build",
            "dependsOrder": "sequence",//按列出的顺序执行任务依赖性
            "dependsOn":[
                "cmake",
                "make"
            ]
        }
    ]

}

猜你喜欢

转载自blog.csdn.net/joun772/article/details/113630250