[CMake] Fortran - Can’t find *.mod

Michael Wild themiwi at gmail.com
Mon Dec 21 15:31:46 EST 2009


On 21. Dec, 2009, at 20:52 , C. Meissa wrote:

> Hello List,
> 
> I’m moving my fortran project to cmake…
> 
> I have a src directory containing 3 dirs:
> main
> mod1
> mod2
> 
> The main program in “main” is to be linked against the libs in “mod1” 
> and “mod2”.
> 
> Additionally “mod2” does need “mod1”, too. (use mod1).
> 
> When compiling gfortran says:
> Fatal Error: Can't open module file 'mod1.mod' for reading at (1): File not 
> found
> 
> This happens even if I statically set the “add_subdirectory()”-statements to 
> the right order.
> Isn’t there a fortran dependency checker?
> 
> I’m using cmake version 2.6-patch 0 from debian lenny.
> 
> Thx a lot in advance
> C.M.
> 

You provide very little information to solve your problem... But I think you need to add a include_directories() call to the place where the .mod file will be created. You can use the variables CMAKE_BINARY_DIR and CMAKE_CURRENT_BINARY_DIR to refer to the top-level binary directory and the current binary directory, respectively.

Michael



More information about the CMake mailing list