CMAKE_MAKE_PROGRAM not found
I have reached the end of my rope with CMake; it has so much potential, but I cannot seem to make it find the basic system tools (i.e. make
) in order to function.
SYMPTOMS
CMake and the CMake GUI produce the following (after deleting the CMakeCache.txt file):
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.
I am focusing on finding make
in this question, however, I've also had many of the same issues with CMake failing to find libraries and other utility files (linker, nm, ar, etc.). The techniques I list below seem to enable CMake to find these files when running under Linux.
SYSTEM
Windows 7 (64-bit); multiple versions of MinGW (32-bit/64-bit); Cmake 2.8.4; NONSTANDARD install location for MinGW (c:/MinGW-32 ).
THINGS I HAVE TRIED
CMakelists.txt contains
SET( CMAKE_MAKE_PROGRAM c:/MinGW-32/bin/make.exe FORCE )
within the first 10 lines of the file.-
Previous versions of CMakelists.txt contained:
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 asCMAKE_C_COMPILER
, etc.
ONE THING THAT HAS WORKED
CMake will successfully create build files IF I use the GUI to populate the CMAKE_MAKE_PROGRAM
variable ("C:/MinGW-32/bin/make.exe").
QUESTION(S)
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?
I have two suggestions:
Do you have make in your %PATH% environment variable? On my system, I need to add %MINGW_DIR%\bin to %PATH%.
Do you have make installed? Depending on your mingw installation, it can be a separate package.
Last resort: Can you pass the full path to make on the commandline?
cmake -D"CMAKE_MAKE_PROGRAM:PATH=C:/MinGW-32/bin/make.exe" ..\Source
In the GUI, select the "Advanced" checkbox. It should now show several entries below. Rename your mingw32-make.exe file to make.exe (you can just make a copy) and set the CMAKE_MAKE_PROGRAM filepath variable to the location of said file.
I’ve just solved the same problem. I had MinGW with GCC and G++ installed but not make
. This command helped me:
mingw-get.exe install mingw32-make
After running it, clear CMake cache (delete the CMakeCache.txt
file in the CMake's working directory) and run CMake again.
On ubuntu, i think I was missing the compiler. Fixed with:
sudo apt install build-essential