# CMake 错误：路径转换从 "C:\Users\User\project" 到 "/cygdrive/c/Users/User/project" 失败。

- **ID:** `cmake/cygwin-path-conversion-failed`
- **领域:** cmake
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

Cygwin 环境由于缺少 cygpath 工具或环境配置错误，无法将 Windows 风格路径转换为 Cygwin 路径。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.20 | active | — | — |
| 3.24 | active | — | — |
| 3.28 | active | — | — |

## 解决方案

1. ```
   确保 cygpath 在 PATH 中：在 Cygwin 终端中运行 `which cygpath`。如果缺失，重新安装 Cygwin 并包含 'cygwin' 包。
   ```
2. ```
   使用原生 Windows CMake（而不是 Cygwin 版本），通过 cmd 或 PowerShell 调用 `cmake.exe`。
   ```

## 无效尝试

- **Manually set the path in CMakeLists.txt using absolute Windows path.** — Cygwin's CMake still expects Cygwin paths internally, causing further errors. (60% 失败率)
- **Reinstall Cygwin with default packages only.** — Cygwin's cygpath is part of the base install; missing it indicates a corrupted environment. (40% 失败率)
