Skip to content

Running CTest rebuilds other build configuration in CMake multi generator configuration #2904

@jorisvanderpol

Description

@jorisvanderpol

Brief Issue Summary

CMake Tools 1.12.27
Visual Studio Code 1.72.2

I have created a project with the following CMakePresets.json:

{
    "version": 6,
    "cmakeMinimumRequired": {
        "major": 3,
        "minor": 25,
        "patch": 1
    },
    "configurePresets": [
        {
            "name": "v140_x64",
            "displayName": "Visual Studio 2015",
            "generator": "Visual Studio 14 2015",
            "architecture": "x64",
            "environment": {
                "CMAKE_CONFIGURATION_TYPES": "Debug;Release"
            }
        }
    ],
    "buildPresets": [
        {
            "name": "v140_x64_debug",
            "displayName": "Build Debug",
            "configurePreset": "v140_x64",
            "configuration": "Debug"
            },
        {
            "name": "v140_x64_release",
            "displayName": "Build Release",
            "configurePreset": "v140_x64",
            "configuration": "Release"
        }
    ],
    "testPresets": [
        {
            "name": "v140_x64_debug",
            "displayName": "Test Debug",
            "configurePreset": "v140_x64",
            "configuration": "Debug"
        },
        {
            "name": "v140_x64_release",
            "displayName": "Test Release",
            "configurePreset": "v140_x64",
            "configuration": "Release"
        }
    ]
}

If I now select the Build Debug as the active build preset and the Test Release as the active test preset, it will build the Debug configuration and run the CTest tests with the Release configuration. This is confusing behavior. Removing the configuration from the test preset will not work (assuming it takes over the configuration of the build preset), as it produces an error (Test not available without configuration).

CMake Tools Diagnostics

No response

Debug Log

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions