【问题标题】:vcpkg is not able to find cmake.cmd when installing a package安装包时 vcpkg 找不到 cmake.cmd
【发布时间】:2019-08-23 13:52:02
【问题描述】:

我尝试在 Windows 10 上安装 vcpkg。我按照 快速启动 部分的步骤操作,但是当我尝试运行此命令时出现错误:

.\vcpkg install sdl2 curl

错误:

error checking existence of file "C:\msys64\usr\bin\cmake.cmd" The filename, directory name, or volume label syntax is incorrect

我安装了msys64cmake

pacman -S cmake

但是C:\msys64\usr\bin\中仍然没有cmake.cmd,只有一个cmake.exe

我尝试使用this content 手动创建C:\msys64\usr\bin\cmake.cmd

if %1 == -E  (
cmake.exe  %* 
) else (
cmake.exe -G "NMake Makefiles"  -DWIN32=1 %*
)
pause 5

但我仍然遇到同样的错误。

【问题讨论】:

    标签: c++ windows cmake msys2 vcpkg


    【解决方案1】:

    看起来它默认为不正确的配置。只需手动指定即可。

    msys 是自动配置的。所以先反转它的安装:

    • 卸载cmake
    • 卸载msys64

    然后为 Windows 执行全新安装:

    • 运行bootstrap-vcpkg.bat
    • 运行vcpkg update
    • 运行vcpkg search sdl2
    • 应该找到一些东西,可能是sdl2:x86-windowssdl2:x64-windows,如果没有,那就是个问题
    • 运行vcpkg install sdl2:x86-windowsvcpkg install sdl2:x64-windows
    • curl 相同

    【讨论】: