title: CMake & MinGW Compilation on Windows, without needing the -G "MinGW Makefiles" flag
body: <p>I want to build my C++ applications from the Windows PowerShell command line using CMake and MinGW.</p>
  
  <p>When I do this in the "normal way," with these commands:</p>
  
  <pre><code>mkdir build
  cd build
  cmake ..
  make
  </code></pre>
  
  <p>CMake chooses Visual Studio as the default compiler, and doesn't generate any Makefiles for me. </p>
  
  <p>I want CMake to use MinGW as the default compiler, and generate Makefiles.
  <strong>It works exactly the way that I want it to when I run these commands</strong>, adding the -G "MinGW Makefiles" flag:</p>
  
  <pre><code>mkdir build
  cd build
  cmake .. -G "MinGW Makefiles"
  make
  </code></pre>
  
  <p>How can I make CMake behave this way all the time, without adding the -G "MinGW Makefiles" flag?</p>
  
  <p>I've tried setting up a <code>CMAKE_GENERATOR</code> environment variable in Windows, and pointing it to "<code>path\to\mingw\bin</code>", "<code>path\to\mingw\bin\mingw32-make.exe</code>", as well as a string that reads "<code>MinGW Makefile</code>". </p>
  
  <p>None of these worked for me after running <code>refreshenv</code> and then trying to run <code>cmake ..</code> again.</p>
  
  <p>Does anybody know if this is the correct environment variable to use in order to specify CMake's default behavior? If it is, what value should I be using?</p>