[CMake] Fortran-C mixed code

Alan W. Irwin irwin at beluga.phys.uvic.ca
Fri Jan 12 16:11:21 EST 2007


On 2007-01-12 12:42-0800 Radu Serban wrote:

> I'm attempting to use cmake to configure a package containing both Fortran 
> (F77) and C source code (as an alternative to the current build system which 
> uses autoconf+libtool) but I couldn't figure out how to properly do that.

Have you considered splitting your library into a fortran-only library and a
C-only library?  Autotools tries to support mixing fortran- and C-compiled
objects in the same library (using the AC_F77_LIBRARY_LDFLAGS macro and the
resulting FLIBS), but we could never get that to work reliably on all
platforms for PLplot.  Thus, we ended up splitting our libraries into
fortran-only and C-only when we were still building with autotools, and we
have continued that approach now we have migrated to cmake.  We didn't have
to do anything special to get this approach to work. Just use the
appropriate ADD_LIBRARY command for each library, and use
TARGET_LINK_LIBRARIES to establish the dependencies between them, and the
result seems to build fine on all platforms.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the Yorick front-end to PLplot (yplot.sf.net); the
Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________


More information about the CMake mailing list