cmake build command fails with output "Error: is not a directory"

Hi,

I’m having major issues with CMake on my system. At least half the time, after I configure a project and when I go to build it, I get just one line of output:

Error: is not a directory

Note that there are two spaces between Error: and is not. It’s like cmake is outputting a blank directory name.

What’s going on here? And how do I fix it? Is a blank directory name being specified somewhere? If so, where?

Sample command line:

cmake --build --target clean --config Release --preset ninja-multi-config-windows-release

CMake versions: 3.23.2, 3.24.3 (same problem with each)
OS: Windows 11 Pro x64
Sometimes running from within CLion, sometimes not (happens either way)
Happens whether or not I’m using presets
Happens across multiple different projects
Happens regardless of build tool (Ninja or MSBuild), C/C++ compiler (cl.exe or clang.exe), etc.
vcpkg is present on the system, but this error occurs regardless of whether the project actually uses it

I think I might have just answered my own question. Possibly. The above is not a valid command line. I need to specify the current directory (.) after --build.

If it was a snake, it would have bit me. Oh well. Perhaps you guys could make the error message slightly clearer, but other than that, PEBKAC, I guess.

Thanks

@robert.maynard Seems the command line parsing has a gap in it. @stephengtuggy Do you mind filing an issue for this? Thanks.

@ben.boeckel Done. Filed as https://gitlab.kitware.com/cmake/cmake/-/issues/24157

Thanks.