Works with VS2010 & CMake 3.24.4 in VSCode:
- Alt+F6 Configure
- F7 Build
./Scripts/CMake/SettingVCVariables.bat
@set JobNum=10
@if "%1" == "" (@set "SrcRootDir=%~dp0..\..")
@set Architecture=x64
@set BuildType=Release
@REM CMake 3.24.4 is the last version that supports vs2010
@set CMakePath=C:\Dev\Tools\CMake\3.24.4\bin\cmake.exe
@set VCDir=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\
@set VCBinDir=%VCDir%bin\
@if %Architecture%==x64 (
@set "VCBinDir=%VCBinDir%amd64\"
) else (
@if %Architecture% NEQ "x86" (goto end)
)
@echo Setting VC %Architecture% variables...
@set CC=%VCBinDir%cl.exe
@set CXX=%CC%
@call "%VCDir%vcvarsall.bat" %Architecture%
@goto :eof
./Scripts/CMake/Configure.bat
@call .\Scripts\CMake\SettingVCVariables.bat
@echo Configuring CMake...
@%CMakePath% --no-warn-unused-cli -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=%BuildType% -H%SrcRootDir% -B%SrcRootDir%/Build -G "MinGW Makefiles"
@goto :eof
./Scripts/CMake/Build.bat
@if %1 NEQ SkipSettingVCVariables (
@call .\Scripts\CMake\SettingVCVariables.bat
)
@echo Building...
@%CMakePath% --build %SrcRootDir%/Build --config %BuildType% --target all -j %JobNum% --
@echo Job done...
@goto :eof
./.vscode/tasks.json
{
"version": "2.0.0",
"tasks": [
{
"label": "CMakeConfigure",
"type": "shell",
"command": "${workspaceFolder}/Scripts/CMake/Configure.bat",
"options": {
"cwd": "${workspaceFolder}/"
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "CMakeBuild",
"type": "shell",
"command": "${workspaceFolder}/Scripts/CMake/Build.bat SettingVCVariables",
"options": {
"cwd": "${workspaceFolder}/"
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": false,
"panel": "shared",
"showReuseMessage": false,
"clear": true
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
%APPDATA%\Code\User\keybindings.json
// Place your key bindings in this file to override the defaultsauto[]
[{
"key": "alt+F6",
"command": "workbench.action.tasks.runTask",
"args": "CMakeConfigure"
}, {
"key": "F7",
"command": "workbench.action.tasks.runTask",
"args": "CMakeBuild"
}
]