title: CMake Error : execution of make failed on Windows
body: <p>I am getting errors when trying to build <a href="https://github.com/nanomsg/nanomsg" rel="noreferrer">nanomsg project</a> in Windows 7:</p>
  
  <pre><code>cmake ..
  -- Building for: NMake Makefiles
  -- The C compiler identification is GNU 4.7.1
  -- Check for working C compiler: C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe
  CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_5d837\fast"
  -- Check for working C compiler: C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe -- broken
  CMake Error at C:/Program Files (x86)/cmake-3.9.4-win64-x64/share/cmake-3.9/Modules/CMakeTestCCompiler.cmake:51 (message):
  The C compiler "C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe" is not
  able to compile a simple test program.
  
  It fails with the following output:
  
  Change Dir: C:/Users/User/Documents/Internal/nanomsg-master/build/CMakeFiles/CMakeTmp
  
  
  
  Run Build Command:"nmake" "/NOLOGO" "cmTC_5d837\fast"
  
  
  
  Generator: execution of make failed.  Make command was: "nmake" "/NOLOGO"
  "cmTC_5d837\fast"
  
  
  
  
  
  CMake will not be able to correctly generate this project.
  Call Stack (most recent call first):
  CMakeLists.txt:29 (project)
  
  
  -- Configuring incomplete, errors occurred!
  See also "C:/Users/User/Documents/Internal/nanomsg-master/build/CMakeFiles/CMakeOutput.log".
  See also "C:/Users/User/Documents/Internal/nanomsg-master/build/CMakeFiles/CMakeError.log".
  </code></pre>
  
  <p>I use <code>gcc</code> compiler and <code>make</code> from <code>Mingw</code> toolchain and I can run succesfully <code>gcc.exe</code> and <code>mingw32-make.exe</code> on a simple example.</p>
  
  <p>In the file <code>CMakeCache.txt</code> the cache variables are set as follows:</p>
  
  <pre><code>//C compiler
  CMAKE_C_COMPILER:FILEPATH=C:/Program Files (x86)/CodeBlocks/MinGW/bin/gcc.exe
  
  //Program used to build from makefiles.
  CMAKE_MAKE_PROGRAM:STRING=nmake
  </code></pre>
  
  <p>I think that the problem comes from <code>CMAKE_MAKE_PROGRAM</code> variable it should take <code>C:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-make.exe</code>, however i dont understand from where it gets the value <code>nmake</code>.</p>
  
  <p>Even i replaced it manually I get the same problem.</p>
  
  <p>My questions :</p>
  
  <ul>
  <li>How CMake fills the Cache variables ?</li>
  <li>Why <code>CMAKE_MAKE_PROGRAM</code> takes the value <code>nmake</code> ?</li>
  <li>Why changing manually this variable didn t solve the problem ?</li>
  </ul>