我已经用 CMake 走到了尽头; 它有很大的潜力,但我似乎不能让它找到基本的系统工具(即 make
)来运行。
CMake 和 CMake GUI 生成以下内容(删除 CMakeCache.txt 文件后) :
Processing top-level CMakelists.txt for project swb
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.
在这个问题中,我将重点放在寻找 make
上,但是,在 CMake 找不到库和其他实用程序文件(链接器、 nm、 ar 等)时,我也遇到了许多相同的问题。下面列出的技术似乎可以使 CMake 在 Linux 下运行时找到这些文件。
Windows7(64位) ; 多个版本的 MinGW (32位/64位) ; Cmake 2.8.4; MinGW (c:/MinGW-32)的非标准安装位置。
Txt 包含文件前10行中的 SET( CMAKE_MAKE_PROGRAM c:/MinGW-32/bin/make.exe FORCE )
。
以前版本的 CMakelists.txt 包含:
find_program(CMAKE_MAKE_PROGRAM
NAMES make
make.exe
DOC "Find a suitable make program for building under Windows/MinGW"
HINTS c:/MinGW-32/bin )
Set CMAKE_MAKE_PROGRAM
in a cmd.exe environment variable prior to running either CMake or CMake-GUI.
Use of a "toolchain" file which identifies CMAKE_MAKE_PROGRAM
as well as CMAKE_C_COMPILER
, etc.
CMake will successfully create build files IF I use the GUI to populate the CMAKE_MAKE_PROGRAM
variable ("C:/MinGW-32/bin/make.exe").
I can get CMake to work if I identify the name of the make program via the GUI. How does one enable CMake to find my make program without user intervention with the Windows 7 (64-bit) / MinGW combination?