CMake is not found when running through make

落爺英雄遲暮 提交于 2019-12-24 07:57:49

问题


I'm trying to build https://github.com/AlbertWerner/cryptonotecoinwallet and facing an issue.

According to the README of the repo, I can run cmake command and it completes without any errors. But then, when I run make, it gives me the below error.

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

I'm using MSYS on Windows and here are the corresponding details.

$ 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

Seems like it's looking for cmake in the wrong path.

Makefile

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

I'm not sure what's wrong. Please help me out.

Thanks.


回答1:


Make sure that you launch MSYS2 using the mingw32.exe executable at the top level of your MSYS2 installation, and that you use that environment when you first run cmake. If you ran CMake in a different environment, remove all the files it created. The commands for running cmake and building the project should be something like this, assuming the developers have set it up in a reasonable way:

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

I didn't try this myself because I am wary of running random code from the internet, but I found this note in the CMakefile indicating that the developers do not support MSYS2:

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

So you will have to spend some effort on porting the Windows-specific code in this program to GCC if you really want to do this.



来源:https://stackoverflow.com/questions/48547690/cmake-is-not-found-when-running-through-make

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!