Bug description
I'm using CMakePresets which mostly works fine.
But if i'm working in a project where the output directory is not yet created i get an error depending on the contents of the CMakePresets.
The project i'm working on has a binaryDir specified in the CMakePresets.json like the following:
"binaryDir": "${sourceDir}/output/${presetName}"
Which uses / as path separators.
When trying to run CMakeGenerate it seems like the ${sourceDir} component is expanded to C:\Path\To\Cwd\./output/debug.
This fails with the following error:
Error executing Lua callback: ...site\pack\packer\start\plenary.nvim/lua/plenary/path.lua:505: We couldn't mkdir: C:\Path\To\Cwd\./output/debug
It seems that the error itself is not caused by cmake or cmake-tools but by the resolved path passed to plenary.
When running cmake --preset debug directly the correct directory is created and the cmake generation is running successfully.
Possible solutions i could think of would be a platform dependend path resolution (Windows Paths <-> Posix Paths) or directly calling cmake so that the mkdir is handled by cmake.
Additional-Info:
If i'm replacing the / with \\ in the CMakePresets.json it is working as expected, but is not portable to linux i guess.
If the directory is already created this issue disappears and CMakeGenerate works as expected.
Steps to reproduce
Minimal configuration
CMakePresets.json:
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 26,
"patch": 0
},
"configurePresets": [
{
"name": "debug",
"displayName": "Debug",
"generator": "Ninja",
"binaryDir": "${sourceDir}/output/${presetName}",
"cacheVariables": {
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "release",
"displayName": "Release",
"inherits": "debug",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release"
}
}
],
"buildPresets": [
{
"name": "debug",
"displayName": "Debug",
"configurePreset": "debug",
"environment": {
"VERBOSE": "1"
}
},
{
"name": "release",
"displayName": "Release",
"configurePreset": "release",
"environment": {
"VERBOSE": "1"
}
}
]
}
And a simple CMake-Project.
I guess i don't have to provide this to you.
:CMakeGenerate
- -> error
Error executing Lua callback: ...site\pack\packer\start\plenary.nvim/lua/plenary/path.lua:505: We couldn't mkdir: C:\Path\To\Cwd\./output/debug
Expected behavior
Well, i'd expect a correctly configured binary-dir which is ready to perform the build step.
Environment
- OS: Windows 10
- CMake 3.30.5
- Neovim v0.11.2
- cmake-tools 1724421
Bug description
I'm using CMakePresets which mostly works fine.
But if i'm working in a project where the output directory is not yet created i get an error depending on the contents of the CMakePresets.
The project i'm working on has a
binaryDirspecified in theCMakePresets.jsonlike the following:Which uses
/as path separators.When trying to run
CMakeGenerateit seems like the${sourceDir}component is expanded toC:\Path\To\Cwd\./output/debug.This fails with the following error:
It seems that the error itself is not caused by cmake or cmake-tools but by the resolved path passed to plenary.
When running
cmake --preset debugdirectly the correct directory is created and the cmake generation is running successfully.Possible solutions i could think of would be a platform dependend path resolution (Windows Paths <-> Posix Paths) or directly calling cmake so that the
mkdiris handled by cmake.Additional-Info:
If i'm replacing the
/with\\in theCMakePresets.jsonit is working as expected, but is not portable to linux i guess.If the directory is already created this issue disappears and
CMakeGenerateworks as expected.Steps to reproduce
Minimal configuration
CMakePresets.json:
{ "version": 3, "cmakeMinimumRequired": { "major": 3, "minor": 26, "patch": 0 }, "configurePresets": [ { "name": "debug", "displayName": "Debug", "generator": "Ninja", "binaryDir": "${sourceDir}/output/${presetName}", "cacheVariables": { "CMAKE_EXPORT_COMPILE_COMMANDS": "ON" } }, { "name": "release", "displayName": "Release", "inherits": "debug", "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } } ], "buildPresets": [ { "name": "debug", "displayName": "Debug", "configurePreset": "debug", "environment": { "VERBOSE": "1" } }, { "name": "release", "displayName": "Release", "configurePreset": "release", "environment": { "VERBOSE": "1" } } ] }And a simple CMake-Project.
I guess i don't have to provide this to you.
:CMakeGenerateExpected behavior
Well, i'd expect a correctly configured binary-dir which is ready to perform the build step.
Environment