[CMake] Fortran 90 Module Issues in CMake

Tim Gallagher tim.gallagher at gatech.edu
Fri Mar 2 10:39:22 EST 2012


I don't know the specifics of this case, but the only time we've ever had trouble with F90 modules is when we add a dependency and don't delete the build tree before trying to reconfigure. 

We have several hundred modules, many in the same directory and many used across directories and don't have any issues with it. I know that's not super helpful to hear when you have an issue, but the dependency scanner does seem to work. 

Have you tried wiping out the entire build tree and trying again? 

Tim 

----- Original Message -----

From: "Matthew Schuchard" <ms503 at gtri.gatech.edu> 
To: "brad king" <brad.king at kitware.com> 
Cc: cmake at cmake.org 
Sent: Friday, March 2, 2012 10:28:09 AM 
Subject: [CMake] Fortran 90 Module Issues in CMake 

>> 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 Yes.
That person also had an issue with one Fortran 90 file using a module built by another Fortran 90 
file in the same target and directory, and had the same error message from gnumake as I did.
His solution was to manually add a dependency since in his case it appeared CMake missed it?
But I have about a hundred instances of this same-target/directory module dependence.

Also, I think some rpm installed in the background without my knowing it, so I restarted Firefox
and now I can view your examples of: http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/Fortran/Library/CMakeLists.txt;hb=v2.8.7 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/Fortran/Library/a.f90;hb=v2.8.7 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/Fortran/Library/b.f90;hb=v2.8.7 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/Fortran/Executable/CMakeLists.txt;hb=v2.8.7 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/Fortran/Executable/main.f90;hb=v2.8.7 Something that confuses me is:

   1 INCLUDE_DIRECTORIES(${Library_MODDIR})

   7 IF(CMAKE_Fortran_MODDIR_FLAG)
   8   SET_TARGET_PROPERTIES(subdir_mods PROPERTIES
   9     Fortran_MODULE_DIRECTORY modules
  10     )
  11 ENDIF(CMAKE_Fortran_MODDIR_FLAG)

If a hardcoded directory "modules" is being specified as the output directory for modules built from
a.f90 and b.f90 when the compiler supports a module output flag, why isn't "modules" in the include 
directories so that a.f90 can find B.mod?  Or is "${Library_MODDIR}" an intrinsic CMake function which 
is assigned the local target's module output directory?

>> 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).

> -Brad

But this is not working for me.  I still have the error:

*** No rule to make target `dir/CMakeFiles/target.a.dir/foo2.mod.stamp', 
needed by `dir/foo.tmp.f'.  Stop.

for add_library(target foo.f90 foo2.f90), where foo.f90 has "USE foo."
This may be a similar issue as my Ada modules having the erroneous requires step which 
caused a red herring error to show up which you caught in January (vis a vis something other
than dependency checking is causing the error).  So why would a make rule for 
*.mod.stamp not be generated? 
-- 

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 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120302/ecba4ebb/attachment.htm>


More information about the CMake mailing list