11

I'm following this tutorial for building GLFW on Windows, and I'm getting the error when running cmake -S . -B Build:

PS ~\glfw-3.3.2\GLFW> cmake -S . -B Build
CMake Error at CMakeLists.txt:3 (project):
  Running

   'nmake' '-?'

  failed with:

   The system cannot find the file specified


-- Configuring incomplete, errors occurred!
See also "~/glfw-3.3.2/GLFW/Build/CMakeFiles/CMakeOutput.log".

Output log is almost completely empty containing only one line with my windows version. I haven't found any discussions or problems matching mine. And I don't even know does nmake have -? flag since it's not listed on microsoft docs site.

I've tried positioning in other folder because maybe that's the case. But with no luck.

I tried solving it with other error solution's but to no avail.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153
luka_bur3k
  • 367
  • 1
  • 2
  • 11
  • 1
    "And I don't even know does nmake have `-?` flag" - This is easy to check: just run `nmake -?` in the terminal. – Tsyvarev Sep 26 '21 at 21:27
  • 1
    The thing is running `nmake -?` results in `'nmake' is not recognized as an internal or external command,operable program or batch file.` And you can think that maybe I need to install `nmake` but cmake works normally for other projects I've written myself and when I just tried to build GLFW the error appeared with no reason whatsoever. – luka_bur3k Sep 27 '21 at 08:27
  • 1
    "cmake works normally for other projects I've written myself" - Probably, for other projects you have used [generators](https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html) other than `NMake Makefiles`. E.g. you have used Visual Studio for those successful projects. – Tsyvarev Sep 27 '21 at 09:07
  • Correct me if I'm wrong but I believe I haven't used any generators as you said. I wrote CmakeLists.txt according to a tutorial in my project and used cmake command to run it. I code in VSC so maybe there is a generator used somewhere not sure. But I did encounter this error while writing my makefiles and it kinda solved it self after configuring CMAKE_CXX_COMPILER flag and in this GLFW project I did also configure that flag but this time it did not help. Maybe error lies somewhere else I'm looking into it and hopefully I'll find an answer. Thanks for suggestions where to look. :D – luka_bur3k Oct 02 '21 at 14:54

2 Answers2

15

The solution was to append -G "MinGW Makefiles" to cmake -S . -B Build command. As Tsyvarev suggested I looked more into generators and found out that setting the flags doesn't imply which generator will be used. So manually setting the flags solved the problem for me.

luka_bur3k
  • 367
  • 1
  • 2
  • 11
  • Amazing, this was the perfect solution to my problem. If you run this flag once, do you ever have to specify this flag again when you build a different project? – Some Guy Mar 10 '23 at 06:13
4

The error is about absent nmake utility, which is a build tool for CMake projects configured with "NMake Makefiles" generator.

You need either to install nmake, or specify (with -G option) other generator, which is available on your platform (Windows) and for which you have a built tool. Possible selection of other generators includes e.g. "MinGW Makefiles" and "Visual Studio" family.

Tsyvarev
  • 60,011
  • 17
  • 110
  • 153