Fortran: Add support for submodules on Cray
Cray Fortran does not include the enclosing module name as a prefix of submodules. Define CMAKE_Fortran_SUBMODULE_SEP
with an empty string to mean that there is no prefix, and set this for Cray.
Also add a default fallback to use the .mod
extension when CMAKE_Fortran_SUBMODULE_EXT
is not set. This is a better guess than no extension at all.
Issue: #18925
Topic-rename: fortran-submodule-cray
Merge request reports
Activity
- Resolved by Brad King
added workflow:wip label
added comp:cray label
- Resolved by Brad King
Thanks for the review @brad.king Would you suggest then that if for any Fortran compiler the
CMAKE_Fortran_SUBMODULE_EXT
variable is missing, we should throw an exception and state that this variable should be defined?
- Resolved by Brad King
When removing the code that adds the default
.mod
extention in this MR, it unexpectedly still works for Cray because of the lines https://gitlab.kitware.com/cmake/cmake/blob/master/Source/cmDependsFortran.cxx#L497-501 that basically re-add the ".mod" extention if no extention is present. So that even if we would print an error message, the build still passes counter-intuitively.Regarding the right level to check for empty
CMAKE_Fortran_SUBMODULE_SEP
value: You are right in that you don't want to break all Fortran projects that don't use submodules. The only place that seems to know when submodules are used is during the parsing of the Fortran files in the "rules". So essentially the above routineSModName
would be a good place.
added 1 commit
- dd794f5c - Add CMAKE_Fortran_SUBMODULE_{SEP,EXT} to Modules/Compiler/Cray-Fortran.cmake
changed milestone to %3.16.0
assigned to @brad.king
- Resolved by Brad King
@wdeconinck1 thanks. I updated your branch to tweak the code, add a comment, and revise the commit messages a bit. Please fetch and reset your checkout (no push needed).
added workflow:nightly-testing label and removed workflow:wip label
- Resolved by Brad King
Great, thank you for the quick action. Will this only be available in 3.16.0 or earlier as well?
changed milestone to %3.15.0
removed workflow:nightly-testing label
mentioned in commit 58d10deb
mentioned in commit 1555837c
- Resolved by Brad King
Hello @brad.king this may be my ignorance in not understanding the workflow. The activity log above shows that the 'fortran-submodule-cray' branch was merged into "release-3.15" branch. But I cannot see it in the current "release" branch, and neither in the just released "3.15-rc4" tag. When and where should it appear?
mentioned in commit 14f69fab
mentioned in issue #20220 (closed)