[CMake] Fortran 90 Module Issues in CMake

Brad King brad.king at kitware.com
Thu Mar 1 16:41:16 EST 2012


On 3/1/2012 3:50 PM, Matthew Schuchard wrote:
>>  I must not understand your example case correctly.  Please post
>>  a sample source tree tarball to reproduce it with CMakeLists.txt
>>  files and the Fortran90 sources.
>
> Unfortunately, this software is also proprietary,

Perhaps you can construct a minimal sanitized example?

 > but I have found that this person:
> http://www.cmake.org/pipermail/cmake/2010-November/040832.html
> had a very similar problem.

This one?

http://thread.gmane.org/gmane.comp.programming.tools.cmake.user/32850/focus=32893

> The problem is I need a Fortran 90 file to be built using a module from another Fortran 90 file in the same
> directory and target, and I need this often.

This is expected to work.  If one Fortran 90 source file in
a single target provides a module and another one uses it then
CMake will detect this and add the proper make dependencies to
build them in the right order (and rebuild).

OTOH if one source in a library target, say a.f90 in libA
provides a module and another source in another target,
say b.f90 in libB requires the module, CMake will detect
it *if* libB links to libA (target_link_libraries).  This
is reasonable because libB couldn't possibly link without
getting symbols from libA since it uses A's module and
makes calls to it.  Directories don't matter.

-Brad


More information about the CMake mailing list