[cmake-developers] Fortran module dependencies and preprocessing in CMake 3.3.0-rc3

Radovan Bast radovan.bast at gmail.com
Thu Jul 2 04:14:33 EDT 2015


dear CMake developers,

We have observed a changed and surprising behavior
in CMake 3.3.0-rc3 with Fortran module dependency scanning and
preprocessing compared to earlier CMake versions
(for instance 3.2.3). I have checked open bugs and email
list archives but could not find this mentioned.

To give an example the following Fortran source fails to compile:
"""
program example
#ifdef SOMEDEF
   use mymodule
#endif
   call hello()
end program
"""

with:
"""
main.F90:3:7:

    use mymodule
       1
Fatal Error: Can't open module file ‘mymodule.mod’ for reading at (1): No
such file or directory
"""

It seems that Fortran dependencies are scanned prior
to pre-processing. This seems different compared to 3.2.3 (and earlier
versions). Not sure this is a bug or a feature.
All relevant files (CMakeLists.txt, main.F90, mymodule.F90) for a complete
minimal example are attached.
I can also submit this directly to http://www.cmake.org/Bug/
in case this is not a feature.

Thank you and best wishes,
  radovan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150702/516637e9/attachment.html>
-------------- next part --------------
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)

project(example)

enable_language(Fortran)

add_definitions(-DSOMEDEF)

add_executable(example.x main.F90 mymodule.F90)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mymodule.F90
Type: text/x-fortran
Size: 163 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150702/516637e9/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: main.F90
Type: text/x-fortran
Size: 82 bytes
Desc: not available
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20150702/516637e9/attachment-0001.bin>


More information about the cmake-developers mailing list