[CMake] Mixing C and Fortran object in same library with MSVC

Bill Hoffman bill.hoffman at kitware.com
Mon Jul 28 10:50:14 EDT 2008


Martin Apel wrote:
> Hi,
> 
> I am trying to generate a DLL on Windows, which contains objects from C 
> source files as well as Fortran source files. When using the nmake 
> generator of cmake 2.6.0, everything works fine, as well as under Linux. 
> However when using the Visual Studio 8 generator, only the C sources are 
> compiled, not the Fortran sources. I suspect this is a bug in MSVC, 
> because the generated .vcproj file contains the Fortran files, but MSVC 
> shows "Custom Build Tool" for the compiler, when selecting "Properties" 
> on a Fortran source file. Or is this a bug in CMake?
> Any help would be very much appreciated.

The IDE does not support mixed C/Fortran.  You would have to put all of 
your Fortran into a separate static or shared library and then link it 
into your C code.

-Bill



More information about the CMake mailing list