Rather than try to explain, have a look at this one I made earlier ....it 
inherits stuff from the parent project, but you should see what’s going on.

http://gitorious.org/hdf5/hdf5-v18/blobs/master/fortran/CMakeLists.txt

scroll down until you see

#-----------------------------------------------------------------------------

# Setup the Fortran auto-detection utilities

# H5test_kind(_SIZEOF).f90 used to generate H5fortran_detect.f90

# H5fortran_detect.f90     used to generate H5fort_type_defines.h

# H5fort_type_defines.h    used to generate H5f90i_gen.h + H5fortran_types.f90

#-----------------------------------------------------------------------------

and then you’ll see chained targets, which generate the next one. Mixing 
C/Fortran will be ok, - note that some of the generated files are listed as 
sources in the next one - this ensures that the rules are defined in succession.

JB


From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf Of ??
Sent: 24 November 2009 16:22
To: CMake List
Subject: [CMake] problem about Fortran and C mixing

Hi all,

I have decided to mix Fortran with C, due to a library that only has C 
interface. Here is the scienario:

suppose there are several programs, file1.f90, file2.f90, file3.c and a C 
library <lib>.

1. file1.f90 calls file2.f90 to generate a executable
2. file2.f90 calls file3.c to generate a module <mod>
3. file3.c calls <lib>

so how to setup CMakeLists.txt? Thanks for Help!

Best regards,

DONG Li
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to