从CMakeLists.txt内部将CMAKE_MAKE_PROGRAM设置为mingw32-make [英] Set CMAKE_MAKE_PROGRAM to mingw32-make from inside the CMakeLists.txt

查看:283
本文介绍了从CMakeLists.txt内部将CMAKE_MAKE_PROGRAM设置为mingw32-make的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在 build中运行 cmake .. ,则遵循这篇文章文件夹,没有任何选项,我会收到错误消息:

Following this post, if I run cmake .. inside my build folder with no options I get the error:


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

我可以通过运行

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

但是,我想从 CMakeLists.txt 文件内部设置 CMAKE_MAKE_PROGRAM .我尝试过

However, I want to set the CMAKE_MAKE_PROGRAM from inside the CMakeLists.txt file. I tried the

if(MSYS)
  set(CMAKE_MAKE_PROGRAM /mingw64/bin/mingw32-make)
endif(MSYS)

但是它不起作用.如果您能帮助我知道如何解决此问题,我将不胜感激.

but it doesn't work. I would appreciate it if you could help me know how I can resolve this problem.

P.S.1. 此处是代码.

P.S.2.我尝试了

set(CMAKE_MAKE_PROGRAM /mingw64/bin/mingw32-makemingw32-make CACHE FILEPATH "" FORCE)

如评论中所建议,但没有帮助.

as suggested in the comments but it did not help.

P.S.3..我的操作系统是Windows 10版本1909,我正在MSYS2终端 MSYS_NT-10.0-18363

P.S.3. My operating system is Windows 10 version 1909, and I'm running the above commands in MSYS2 terminal MSYS_NT-10.0-18363

推荐答案

好的,我想我已经解决了这个问题.从此处,我需要安装MSYS2的 make :

Ok, I think I solved the problem. From here, I needed to install the MSYS2's make:

pacman -S make

这对我来说也似乎是一种趋势.我最近在MSYS2中遇到了几个问题,这些问题已通过删除MinGW程序包并将其替换为MSYS2程序包来解决.因此,它告诉我,在MSYS2中工作时,如果有MSYS2软件包,我应该偏爱它们.

This seems like a trend too me. I have recently had several problems in MSYS2 which have been resolved by removing the MinGW package and replacing it with the MSYS2 package. So it tells me that when working inside MSYS2 I should favor MSYS2 packages if they are available.

这篇关于从CMakeLists.txt内部将CMAKE_MAKE_PROGRAM设置为mingw32-make的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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