# Call CMake Cygwin with windows style path (C:\\)

**URL:** https://discourse.cmake.org/t/call-cmake-cygwin-with-windows-style-path-c/11599
**Category:** Usage
**Tags:** os:windows, os:cygwin
**Created:** [September 6, 2024, 1:13pm UTC](https://discourse.cmake.org/t/call-cmake-cygwin-with-windows-style-path-c/11599 "2024-09-06T13:13:37Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![kuch3n](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/958977/32.png) [@kuch3n](https://discourse.cmake.org/u/kuch3n)
#### Post date: [September 6, 2024, 1:13pm UTC](https://discourse.cmake.org/t/call-cmake-cygwin-with-windows-style-path-c/11599/1 "2024-09-06T13:13:37Z")

</div>

If cygwins cmake is called with windows style paths and the build directory is missing, cmake will create two build directories from `-B "C:\\dir1\\dir2\\project\\build"`:

- `C`
- probably a relative path from the root of the current drive `\\dir1\\dir2\\project\\build`, see [File path formats on Windows systems - .NET | Microsoft Learn](https://learn.microsoft.com/en-us/dotnet/standard/io/file-path-formats#traditional-dos-paths)

Is there any possibility to manipulate those paths before CMake creates and uses them? Or set a variable so CMake will parse above path as a windows style one?

Additionaly, calling CMake with a windows style path, will lead to non obvious problems when adding sources inside binary dir, or using ExternalProject etc. (no warning is given)

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [September 6, 2024, 1:54pm UTC](https://discourse.cmake.org/t/call-cmake-cygwin-with-windows-style-path-c/11599/2 "2024-09-06T13:54:09Z")

</div>

Tools in the cygwin environment are not able to handle windows paths. This is also the case for CMake and this behavior will not change.  
You can use `cygpath` tool to convert windows paths to cygwin ones.

---

<div class="post-metadata">

### Author: ![kuch3n](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/958977/32.png) [@kuch3n](https://discourse.cmake.org/u/kuch3n)
#### Post date: [September 6, 2024, 2:02pm UTC](https://discourse.cmake.org/t/call-cmake-cygwin-with-windows-style-path-c/11599/3 "2024-09-06T14:02:23Z")

</div>

yes, cygpath is an explicit way of translating those paths. But i’m search an implicit way of transforming those paths while calling CMake or setting a CMAKE variable.

For now i found `CMAKE_HOME_DIRECTORY` which can be given as arg/preset to CMake, but CMake needs to be run from project folder as cwd or the variable value needs to be set to the project folder. The later case looks like a non portable variant.

Keep in mind, that there are various IDEs to handle calls to cmake, e.g., CMake Tools for VSCode. So explicit calls to cygpath are not possible, see [Bug with cmake.buildDirectory · Issue #4038 · microsoft/vscode-cmake-tools · GitHub](https://github.com/microsoft/vscode-cmake-tools/issues/4038)

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [September 6, 2024, 2:07pm UTC](https://discourse.cmake.org/t/call-cmake-cygwin-with-windows-style-path-c/11599/4 "2024-09-06T14:07:17Z")

</div>

Why do you want to use the cygwin variant of CMake if you are in a pure Windows environment? Use the `Windows` one!!
