mingw下的cmake有什么问题 [英] What is wrong with cmake under mingw

查看:135
本文介绍了mingw下的cmake有什么问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

mkdir build
cd build
cmake -G "MinGW Makefiles" ..

I的

CMake Error at I:/msys64/mingw32/share/cmake-3.13/Modules/CMakeMinGWFindMake.cmake:12 (message):
  sh.exe was found in your PATH, here:

  I:/msys64/usr/bin/sh.exe

  For MinGW make to work correctly sh.exe must NOT be in your path.

  Run cmake from a shell that does not have sh.exe in your PATH.

  If you want to use a UNIX shell, then use MSYS Makefiles.

Call Stack (most recent call first):
  CMakeLists.txt:16 (PROJECT)


CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

,但看起来令人反感的 sh.exe 是msys的一部分?

but it would appear the the offending sh.exe is part of msys??

rm -rf build
mkdir build
cd build
cmake -G "MinGW Makefiles" ..

I的

CMake Error at I:/msys64/mingw32/share/cmake-3.13/Modules/CMakeMinGWFindMake.cmake:12 (message):
  sh.exe was found in your PATH, here:

  I:/msys64/usr/bin/sh.exe

  For MinGW make to work correctly sh.exe must NOT be in your path.

  Run cmake from a shell that does not have sh.exe in your PATH.

  If you want to use a UNIX shell, then use MSYS Makefiles.

Call Stack (most recent call first):
  CMakeLists.txt:16 (PROJECT)


CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

同一件事.

应该没有 sh.exe 吗?

cmake -G"MinGW Makefiles" -DCMAKE_SH ="CMAKE_SH-NOTFOUND" ..

$ cmake -G "MinGW Makefiles" -DCMAKE_SH="CMAKE_SH-NOTFOUND" ..
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

所以看来还有第二个问题?

So it would seem there's a second problem as well?

有什么帮助吗?谢谢.

推荐答案

首先,请确保已安装 mingw32-make :

which mingw32-make

如果不是/mingw64/bin/mingw32-make ,则该路径不在您的〜/.bashrc 中或未安装.我想您可以通过以下方式安装它:

if not /mingw64/bin/mingw32-make then either the path is not in your ~/.bashrc or it is not installed. I think you can install it by

pacman -S mingw64/mingw-w64-x86_64-make

,它也是您可能已经安装的 mingw-w64-x86_64-toolchain 的一部分.那么你应该可以运行

which is also part of mingw-w64-x86_64-toolchain that you have probably already installed. then you should be able to run

cmake -D CMAKE_MAKE_PROGRAM:PATH=/mingw64/bin/mingw32-make

请尝试一下,让我知道这是否适合您.

please give it a try and let me know if this works for you.

这篇关于mingw下的cmake有什么问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆