[CMake] cmake and MinGW

Bill Hoffman bill.hoffman at kitware.com
Wed Feb 27 17:42:12 EST 2013


On 2/27/2013 5:28 PM, Donald Robinson wrote:
> The crux of my problem seems to be having Cmake behave when it is run
> from a command line in the directory in which CMakeLists.txt is found.
> When run from a sub-directory, everything works fine. I’ve cleaned and
> re-run this a few times to make sure the description I’ve given is
> correct; the behavior is repeatable. A workaround is to execute cmake
> from a different directory! But I was hoping to do better than that if
> possible.
>
> Any suggestions? Next steps to try? I’m still happy to package up
> whatever would help to sort this out. I’ve also attached the
> CMakeLists.txt file, in case you’d like to inspect that.
>
Adding the cmake list back in now that I have the files.


I think that at one point you ran cmake in your source tree with the 
nmake generator.  This will leave files in the tree and information in 
the CMakeCache.txt file that will force cmake to always use that.   I 
would strongly recommend that you do not use "in-source" builds as they 
pollute your build tree and cause havoc like this to happen...

If you start from a totally clean checkout of your source tree it should 
work.

If you look in your log1 you can see it has picked the nmake generator:
-- tobuild = D:/open-fvs/branches/dev/bin/FVSwsc_sourceList.txt
-- Building for: NMake Makefiles  ****** trouble is here ******
-- The C compiler identification is GNU 4.7.2
-- The Fortran compiler identification is GNU
-- Check for working C compiler: C:/MinGW/bin/mingw32-cc.exe

That is the problem.

If you remove the CMakeCache.txt file and the CMakeFiles directory from 
your source tree it should fix your problem.

-Bill


More information about the CMake mailing list