Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong evaluation of CMakePresets.json #1787

Closed
reddwarf69 opened this issue Apr 20, 2021 · 3 comments
Closed

Wrong evaluation of CMakePresets.json #1787

reddwarf69 opened this issue Apr 20, 2021 · 3 comments
Assignees
Labels
bug a bug in the product Feature: presets fixed (release pending) fixed in pre-release and is pending official release
Projects
Milestone

Comments

@reddwarf69
Copy link

https://github.com/microsoft/vscode-cmake-tools/blob/develop/docs/cmake-presets.md#supported-cmake-and-cmakepresetsjson-versions says "CMake Tools reads and evaluates CMakePresets.json and CMakeUserPresets.json, and does not invoke CMake directly with the --preset option.", unfortunately with CMake Tools 1.7.0 the evaluation is not equivalent to the one done by CMake.

https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#macro-expansion says "All macros are evaluated in the context of the preset being used, even if the macro is in a field that was inherited from another preset.". And when using

{
    "version": 2,
    "cmakeMinimumRequired": {
        "major": 3,
        "minor": 20,
        "patch": 0
    },
    "configurePresets": [
        {
            "name": "Base",
            "hidden": true,
            "generator": "Ninja",
            "binaryDir": "build/${presetName}"
        },
        {
            "name": "Complete",
            "inherits": "Base"
        }
    ]
}

and using the "Complete" preset CMake Tools uses build/Base as binaryDir while CMake uses build/Complete.

@bobbrow
Copy link
Member

bobbrow commented Apr 20, 2021

Thanks for reporting this. @xisui-MSFT can you take a look?

@bobbrow bobbrow added bug a bug in the product Feature: presets labels Apr 20, 2021
@bobbrow bobbrow added this to To do in 1.7.1 Apr 20, 2021
@bobbrow bobbrow moved this from To do to In progress in 1.7.1 Apr 20, 2021
@andreeis andreeis added the fixed (release pending) fixed in pre-release and is pending official release label Apr 22, 2021
@andreeis andreeis moved this from In progress to Done in 1.7.1 Apr 22, 2021
@andreeis
Copy link
Contributor

The PR with a fix for this problem was merged in the GitHub repository and, if you'd like, you can validate it by installing this custom vsix before we release the official 1.7.1.
https://github.com/microsoft/vscode-cmake-tools/actions/runs/774916180

@andreeis andreeis added this to the 1.7.1 milestone Apr 22, 2021
@andreeis
Copy link
Contributor

CMake Tools 1.7.1 was released today and it contains a fix for this issue. Upgrade the extension in VSCode and let us know if you encounter any other problems.

@github-actions github-actions bot locked and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug a bug in the product Feature: presets fixed (release pending) fixed in pre-release and is pending official release
Projects
No open projects
1.7.1
Done
Development

No branches or pull requests

4 participants