[CMake] MinGW platform modules for C/CXX and Fortran

Gerald Hofmann gerald.hofmann at cosin.eu
Thu Feb 18 05:38:10 EST 2010


Hi *

I'm trying to fix some apparently incomplete modules for mingw cross compilation on a Linux/Mac host. Im using a gcc/gfortran cross compiler toolchain to build for win32 and win64 from a complex C/Fortran mixed language project.

As far as I found out, for the C/CXX sources, cmake uses Platform/Windows-gcc.cmake for basic settings. For Fortran sources I found some include rules in CMakeFortranInformation.cmake, but as far as I can see there is no matching Windows-GNU-Fortran module yet. If no Fortran settings are defined, cmake uses C flags for Fortran as well. But something seems to be incomplete here.

For the Fortran part I created the missing Windows-GNU-Fortran.cmake myself. The file is correctly included by CMakeFortranInformation.cmake (by setting up the file name using platform and compiler ID). With my settings I am able to build Windows targets with Win-style suffix (dll, lib). I will post the module for a review as soon as it is finally tested.

Please give me some pointers to help me fixing the MinGW modules:

- Do I understand the basics for the compiler/platform module naming and including right? Would it be an option to provide Windows-GNU-C, Windows-GNU-CXX and Windows-GNU-Fortran modules instead of Windows-gcc (apparently not matching the general naming scheme)?

- Is there a good reason why platform-specific prefix/postfix settings are provided by a compiler-specific module? Is there a better place for platform-specific settings applicable to all compilers?

- Should the mingw target not better prefer Windows library prefix/postfix settings over Unix style lib prefix and .a suffix?

Thank you in advance!

Gerry



More information about the CMake mailing list