[CMake] cmake and MinGW - resolution

Donald Robinson drobinson at essa.com
Thu Feb 28 11:56:24 EST 2013


Thanks to Bill Hoffmann and Alan Irwin for helping work through this MinGW
problem. As it turns out, the problem in my CMakeLists.txt file wasn't the
residual presence of a CMakeFiles directory or a CMakeCache.txt file, or the
command-line, which is correctly:

 

   Cmake -G "MinGW Makefiles"

 

Mea culpa. The source of the problem was due to the fact that the my parent
CMakeLists.txt file dynamically creates and then processes a set of child
CMakeLists.txt files. After creating them, those files (each in a
subdirectory) are run using the following loop in the parent file:

 

   foreach(toProcess ${dirsToProcess})

    execute_process(COMMAND cmake CMakeLists.txt WORKING_DIRECTORY
${toProcess})

   endforeach(toProcess)

 

Although the parent was happily running with the MinGW flags, these child
processes were not. I should have noticed this immediately. The solution is
to embed the MinGW flag within that loop. Doing that, the build proceeds
normally.

 

   foreach(toProcess ${dirsToProcess})

     execute_process(COMMAND cmake -G "MinGW Makefiles" CMakeLists.txt
WORKING_DIRECTORY ${toProcess})

   endforeach(toProcess)

 

The general solution will be to build this out a bit more for different
platforms.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130228/f6c32a01/attachment-0001.htm>


More information about the CMake mailing list