c++ - 运行 make 时找不到 CMake

标签 c++ makefile cmake msys

我正在尝试构建 https://github.com/AlbertWerner/cryptonotecoinwallet并面临一个问题。

根据存储库的自述文件,我可以运行 cmake 命令并且它完成时没有任何错误。但是,当我运行 make 时,它给出了以下错误。

$ make
make: /usr/bin/cmake: Command not found
make: *** [Makefile:5138: cmake_check_build_system] Error 127

我在 Windows 上使用 MSYS,以下是相应的详细信息。

$ echo $PATH
/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/mingw32/bin

$ which cmake
/mingw32/bin/cmake

似乎它在错误的路径中寻找cmake

生成文件

cmake_check_build_system:
    $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
.PHONY : cmake_check_build_system # <== Line 5139

我不确定出了什么问题。请帮帮我。

谢谢。

最佳答案

确保您使用 MSYS2 安装顶层的 mingw32.exe 可执行文件启动 MSYS2,并在首次运行 cmake 时使用该环境。如果您在不同的环境中运行 CMake,请删除它创建的所有文件。假设开发人员已经以合理的方式设置了它,运行 cmake 和构建项目的命令应该是这样的:

mkdir build
cd build
cmake .. -G"MSYS Makefiles"
make

我自己没有尝试这个,因为我对运行来自互联网的随机代码持谨慎态度,但我在 CMakefile 中发现了此注释,表明开发人员不支持 MSYS2:

if (WIN32)
  if (NOT MSVC)
        message(FATAL_ERROR "Only MSVC is supported on this platform")
  endif ()
  ...

因此,如果您确实想这样做,则必须花费一些精力将该程序中的 Windows 特定代码移植到 GCC。

关于c++ - 运行 make 时找不到 CMake,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48547690/

相关文章:

c++ - 在 cocos2dx 中转换后场景卡住

c++ - 可以将 std::streambuf 的自定义实现中的异常传递给流用户吗?

c++ - 使用 libav* 库的 FFMPEG 音频转码

makefile - makefile 中的预构建步骤

python - 操作系统错误 : cannot open shared object file: No such file or directory even though file is in the folder

c++ - CMake:C++ 包含相对于基本目录

c++ - 静态枚举忽略类内的警告

c++ - 无法在带有 conan 的 cmake 中找到请求的 Boost 库

cmake - 为什么 CMake 拒绝使用非默认编译器?

linux - 在 Linux 上选择 makefile 和 Makefile