[CMake] Fortran 90 Module Issues in CMake
Matthew Schuchard
ms503 at gtri.gatech.edu
Fri Mar 2 10:28:09 EST 2012
>> 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?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120302/d10d1f46/attachment-0001.htm>
More information about the CMake
mailing list