Our tools are cmake v3.25.2
and MSBuild-Version 17.11.2+c078802d4
für .NET Framework
Microsoft Visual Studio Professional 2022 (64-bit) - Current Version 17.11.2
on Windows 11
We create a visual studio 2022
project with this options:
call "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars32.bat"
cmake -G "Visual Studio 17 2022" -B build -S . -A Win32 -D CMAKE_GENERATOR_TOOLSET=v100 -D BUILD_TESTS=YES -D BUILD_TOOLS=YES -D BUILD_TESTS_REMOTE=YES -D BUILD_SHARPTEST=YES -D CMAKE_CONFIGURATION_TYPES=Release # or Debug only! CK
Or with this cmake Preset (from cmd or with cmake-gui)
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 25,
"patch": 0
},
"configurePresets": [
{
"name": "Ninja_Debug",
"displayName": "Windows Debug only configuration",
"description": "This preset is only available on Windows",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"binaryDir": "${sourceDir}/build",
"installDir": "${sourceDir}/stagedir",
"generator": "Ninja",
"cacheVariables": {
"CMAKE_PREFIX_PATH": {
"type": "path",
"value": "${sourceDir}/stagedir"
},
"BUILD_LONG_RUNNING_TESTS": true,
"BUILD_SHARED_LIBS": false,
"BUILD_TESTS": true,
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_CONFIGURATION_TYPES": "Debug",
"CMAKE_CXX_COMPILER": "cl",
"CMAKE_CXX_EXTENSIONS": false,
"CMAKE_CXX_STANDARD": "11",
"CMAKE_CXX_STANDARD_REQUIRED": true,
"CMAKE_C_COMPILER": "cl",
"CMAKE_DEBUG_POSTFIX": "D",
"CMAKE_INSTALL_MESSAGE": "LAZY",
"CMAKE_RUNTIME_OUTPUT_DIRECTORY": "${sourceDir}/build/bin",
"CMAKE_UNITY_BUILD": false
},
"environment": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "YES",
"CTEST_OUTPUT_ON_FAILURE": "YES",
"CTEST_PARALLEL_LEVEL": "1",
"CPM_USE_LOCAL_PACKAGES": "YES"
},
"warnings": {
"deprecated": true,
"uninitialized": false
}
},
{
"name": "Release",
"inherits": "Ninja_Debug",
"displayName": "Windows Release only configuration",
"description": "This preset is only available on Windows",
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
},
"generator": "Visual Studio 17 2022",
"architecture": "Win32",
"toolset": "v100",
"cacheVariables": {
"BUILD_TESTS": false,
"CMAKE_CONFIGURATION_TYPES": "Release",
"CMAKE_BUILD_TYPE": "Release"
},
"vendor": {
"microsoft.com/VisualStudioSettings/CMake/1.0": {
"clangTidyChecks":
"-*, bugprone-*, cert-*, misc-*, -misc-const-correctness, -misc-include-cleaner, -modernize-*, -readability-*, performance-*, portability-*, concurrency-*",
"enableMicrosoftCodeAnalysis": true,
"enableClangTidyCodeAnalysis": true
}
}
}
]
# ...
}
If we open the generated solution and start the build, wie get error for each target?
But if we open with vs2022
the project folder directly, our Release preset is loaded and it works fine!