0

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!

which I can solve by running

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

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. Here is the code.

P.S.2. I tried the

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. My operating system is Windows 10 version 1909, and I'm running the above commands in MSYS2 terminal MSYS_NT-10.0-18363

11
  • In this answer: Why doesn't "CMAKE_MAKE_PROGRAM" variable take effect?, see that you need to set CMAKE_MAKE_PROGRAM as a cache variable, not a regular CMake variable. Commented Apr 8, 2020 at 18:51
  • @squareskittles I tried the set(CMAKE_MAKE_PROGRAM mingw32-make CACHE FILEPATH "" FORCE) but it did not work. Commented Apr 8, 2020 at 19:09
  • What do you mean by "it did not work"? Do you get the same error message as shown in your question post? Also, to be safe, you should use the full path to the make program when setting this variable. Commented Apr 8, 2020 at 19:12
  • @squareskittles yes the exact same error. I tried the full path too. see the P.S.2. Commented Apr 8, 2020 at 19:13
  • 1
    The error is peculiar. Can you provide some background information about your development environment? What OS are you using? The MinGW path you use appears to be a Unix path? Why is that? Commented Apr 8, 2020 at 20:22

1 Answer 1

1

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

pacman -S make

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.