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

**URL:** https://discourse.cmake.org/t/cmake-build-command-fails-with-output-error-is-not-a-directory/6854
**Category:** Usage
**Created:** [November 12, 2022, 5:24pm UTC](https://discourse.cmake.org/t/cmake-build-command-fails-with-output-error-is-not-a-directory/6854 "2022-11-12T17:24:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![stephengtuggy](https://discourse.cmake.org/user_avatar/discourse.cmake.org/stephengtuggy/32/2918_2.png) [@stephengtuggy](https://discourse.cmake.org/u/stephengtuggy)
#### Post date: [November 12, 2022, 5:24pm UTC](https://discourse.cmake.org/t/cmake-build-command-fails-with-output-error-is-not-a-directory/6854/1 "2022-11-12T17:24:58Z")

</div>

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

---

<div class="post-metadata">

### Author: ![stephengtuggy](https://discourse.cmake.org/user_avatar/discourse.cmake.org/stephengtuggy/32/2918_2.png) [@stephengtuggy](https://discourse.cmake.org/u/stephengtuggy)
#### Post date: [November 12, 2022, 5:38pm UTC](https://discourse.cmake.org/t/cmake-build-command-fails-with-output-error-is-not-a-directory/6854/2 "2022-11-12T17:38:33Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 12, 2022, 8:37pm UTC](https://discourse.cmake.org/t/cmake-build-command-fails-with-output-error-is-not-a-directory/6854/3 "2022-11-12T20:37:46Z")

</div>

@robert.maynard Seems the command line parsing has a gap in it. @stephengtuggy Do you mind filing [an issue](https://gitlab.kitware.com/cmake/cmake/-/issues) for this? Thanks.

---

<div class="post-metadata">

### Author: ![stephengtuggy](https://discourse.cmake.org/user_avatar/discourse.cmake.org/stephengtuggy/32/2918_2.png) [@stephengtuggy](https://discourse.cmake.org/u/stephengtuggy)
#### Post date: [November 12, 2022, 11:00pm UTC](https://discourse.cmake.org/t/cmake-build-command-fails-with-output-error-is-not-a-directory/6854/4 "2022-11-12T23:00:30Z")

</div>

> [@stephengtuggy](#):
>
> 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

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

Thanks.
