Support for Visual Studio CMake Solutions and the Ninja build tool¶
The CMake tool can be used in its "traditional" manner, in that it generates Visual Studio Solutions and Projects. However, new to Microsoft Visual Studio is its support for a "CMake" project type.
This means that the CMakeLists.txt file "replaces" the traditional .vcxproj and .sln files. Also, the default build tool changes from msbuild.exe to ninja.exe.
The Turbo Build Accelerator supports build acceleration using Visual Studio CMake Solutions and the Ninja build tool.
To enable this simply edit your CMakeSettings.json (for vs2019) to add the variables CMAKE_C_COMPILER and CMAKE_CXX_COMPILER:
{
"configurations": [
{
"name": "x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x64_x64" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"variables": [
{
"name": "CMAKE_CXX_COMPILER",
"value": "C:/Program Files (x86)/Turbo/bin/turbo-cl_x64.exe",
"type": "FILEPATH"
},
{
"name": "CMAKE_C_COMPILER",
"value": "C:/Program Files (x86)/Turbo/bin/turbo-cl_x64.exe",
"type": "FILEPATH"
}
]
}
]
}
For vs2022 onwards you can adjust your CMakePresets.json by adding CMAKE_C_COMPILER and CMAKE_CXX_COMPILER in a cacheVariables as below :
{
"version": 3,
"configurePresets": [
{
"name": "windows-base",
"hidden": true,
"generator": "Ninja",
"binaryDir": "${sourceDir}/out/build/${presetName}",
"installDir": "${sourceDir}/out/install/${presetName}",
"cacheVariables": {
"CMAKE_C_COMPILER": "C:/Program Files (x86)/Turbo/bin/turbo-cl_x64.exe",
"CMAKE_CXX_COMPILER": "C:/Program Files (x86)/Turbo/bin/turbo-cl_x64.exe"
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
...
For building with Clang(LLVM) then adjust the above to use turbo-clangcl_x64.exe instead of turbo-cl_x64.exe.