title: using cmake with mingw-w64 error compiling test program
body: <p>I'm trying to do a simple compilation with mingw-w64 and cmake. But for some reason I can't. It fails verifying if gcc can compile a C program which is weird. Any ideas? </p>
  
  <p>Thanks</p>
  
  <p>Paulo </p>
  
  <pre><code>C:\work\opencv\myown\hello&gt;cmake -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CC_COMPILER=gcc
  -- The C compiler identification is GNU 5.3.0
  -- The CXX compiler identification is GNU 5.3.0
  -- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-5.3.0-win32-seh-rt_v4-rev0/mingw64/bin/gcc.exe
  CMake Error: Generator: execution of make failed. Make command was: "nmake" "/NOLOGO" "cmTC_8ce25\fast"
  -- Check for working C compiler: C:/Program Files/mingw-w64/x86_64-5.3.0-win32-seh-rt_v4-rev0/mingw64/bin/gcc.exe -- broken
  CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.5/Modules/CMakeTestCCompiler.cmake:61 (message):
    The C compiler "C:/Program
    Files/mingw-w64/x86_64-5.3.0-win32-seh-rt_v4-rev0/mingw64/bin/gcc.exe" is
    not able to compile a simple test program.
  
    It fails with the following output:
  
     Change Dir: C:/work/opencv/myown/hello/CMakeFiles/CMakeTmp
  
  
  
    Run Build Command:"nmake" "/NOLOGO" "cmTC_8ce25\fast"
  
  
  
    Generator: execution of make failed.  Make command was: "nmake" "/NOLOGO"
    "cmTC_8ce25\fast"
  
  
  
  
  
    CMake will not be able to correctly generate this project.
  Call Stack (most recent call first):
    CMakeLists.txt:7 (project)
  
  
  -- Configuring incomplete, errors occurred!
  See also "C:/work/opencv/myown/hello/CMakeFiles/CMakeOutput.log".
  See also "C:/work/opencv/myown/hello/CMakeFiles/CMakeError.log".
  </code></pre>