28

I am trying to use cmake to build the Box2D library for c++. When I run cmake gui I get the error:

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!

Most questions like these people have answered by saying "Add MinGw/bin to the PATH" but I already have that on the PATH. What else could be causing this error?

user0042
  • 7,917
  • 3
  • 24
  • 39
Starfruit
  • 409
  • 1
  • 4
  • 9
  • 3
    what happens if you type `mingw32-make` and then press enter? That should not output `'mingw32-make' is not recognized as an internal or external command, operable program or batch file.` Instead, it should output `mingw32-make: *** No targets specified and no makefile found. Stop.` – rubenvb Jul 17 '17 at 17:31
  • It does output "'mingw32-make' is not recognized as an internal or external command, operable program or batch file". Did I install MinGW incorrect? – Starfruit Jul 17 '17 at 18:12
  • Well, at least `mingw32-make` isn't in your PATH, and that's exactly what CMake is telling you. Check if that program is in the `bin` directory that you do have in PATH. – rubenvb Jul 17 '17 at 18:15
  • Nope. Thanks for the help. Do you know if there is a place where i can download that program by itself? – Starfruit Jul 17 '17 at 18:46
  • here you go: https://app.box.com/shared/static/7wfzv4ux6eo4gms9easv4tvu32wkhj84.zip – MultipleMonomials Jul 18 '17 at 03:16

4 Answers4

14

mingw32-make.exe can be installed with the standard MinGW32 installer via the appropriate checkbox:

MinGW32 Installation Manager screenshot

As rubenvb points out, you'll still need to ensure that it makes it into your PATH. If you edit your environment variables via System Properties, be sure to close and reopen the CMake GUI.

If you're more accustomed to using make.exe, install MSYS and use MSYS Makefiles as the CMake generator. You'll also need to put both mingw\bin and msys\1.0\bin into your PATH.

jdonald
  • 670
  • 7
  • 15
4

You can check this answer: https://stackoverflow.com/a/74240235/3110429

  1. Firstly check the system.

  2. Install MINGW https://www.msys2.org/

  3. Install gcc, g++, gdb, and cmake using pacman.

    pacman -S mingw-w64-x86_64-gcc

    pacman -S mingw-w64-x86_64-gdb

    pacman -S mingw-w64-x86_64-cmake

  4. Check installation:

    gcc --version

    g++ --version

    gdb --version

  5. Edit environment variables for your account (PATH)

    C:\msys64\mingw64\bin

For cmake project on Vscode:

  1. Create a cmake project: https://code.visualstudio.com/docs/cpp/cmake-linux#_create-a-cmake-project

  2. Choose the Kit (Toolchain) which was installed before

  3. Set cmake.cmakePath (If you installed with pacman, the path should be same as gcc/g++.

    "cmake.cmakePath": "C:\msys64\mingw64\bin\cmake.exe"

  4. Reset VScode: Ctrl+shift+P and type "CMake:Reset CMake Tools for Extension State"

  5. Configure project: Ctrl+shift+P and type "CMake: Configure". You will see "built" directory and generated files.

gkhanacer
  • 575
  • 7
  • 25
2

I had the same problem and I added these three to my system path and errors were solved.

C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin

C:\Program Files\CMake\bin

C:\opencv\build\install\x64\mingw\bin

Chamila Maddumage
  • 3,304
  • 2
  • 32
  • 43
1

In the path MinGW\bin try to find make.exe or mingw32-make.exe. If you don't have it then mingw32-make.exe can be installed with the standard MinGW32 installer as shown in the pervious answer.

Then have a second copy of make.exe or mingw32-make.exe to have identical two files with those names make.exe and mingw32-make.exe and it solved my problem.

shmsr
  • 3,802
  • 2
  • 18
  • 29
Tarek
  • 11
  • 1