Fortran: Suprious dependencies with submodules
CMake creates a spurious dependency on `real.mod` for submodule module functions of the form: ``` module real function x() end function x ``` This results in unnecessary recompilation of code. (other similiar constructs with the same problem include: ``` module pure real function x() end function x ``` ``` module pure elemental real function x() end function x ``` ``` module impure real function x() end function x ``` ``` module pure function x() real :: x end function x ``` ``` module elemental real function x() end function x ``` ``` module pure subroutine point_dist() end subroutine point_dist ``` etc). <pre> cmake -G Ninja ../submodule2 ninja [6/6] Linking Fortran static library libpoints.a ninja [2/2] Linking Fortran static library libpoints.a ninja -d explain ninja explain: loading dyndep file 'CMakeFiles/points.dir/Fortran.dd' ninja explain: output real.mod doesn't exist ninja explain: CMakeFiles/points.dir/points_a.f90.o is dirty ninja explain: libpoints.a is dirty [2/2] Linking Fortran static library libpoints.a </pre> It looks like `Source/LexerParser/cmFortranParser.y` line 113 doe not handle a type before the function name or 'pure', 'impure' or 'elemental' before function or subroutine: ``` | MODULE WORD other EOSTMT { cmFortranParser* parser = cmFortran_yyget_extra(yyscanner); if (cmsysString_strcasecmp($2, "function") != 0 && cmsysString_strcasecmp($2, "procedure") != 0 && cmsysString_strcasecmp($2, "subroutine") != 0) { cmFortranParser_RuleModule(parser, $2); } ``` </pre> [points.f90](/uploads/97e37cb5a786ae383283672c9a34c3d2/points.f90) [CMakeLists.txt](/uploads/18413671b74c11bd5be9b7411779665d/CMakeLists.txt) [points_a.f90](/uploads/62ebb65154dd4fa4f2a8c76c41f660df/points_a.f90)
issue