luka_bur3k
luka_bur3k

Reputation: 547

Error while configuring CMake project: Running 'nmake' '-?' failed

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.

Upvotes: 22

Views: 70383

Answers (3)

Ayush Goyal
Ayush Goyal

Reputation: 31

As others suggested, you can use other generators, but if you want to use NMake for your builds.

  1. Install NMake via this
  2. Make sure NMake is in your path in the environment variable. My Path looks like:

C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.39.33519\bin\Hostx64\x64

Upvotes: 2

Tsyvarev
Tsyvarev

Reputation: 65936

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.

Upvotes: 7

luka_bur3k
luka_bur3k

Reputation: 547

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.

Upvotes: 22

Related Questions