Browse Source

Merge branch 'fortran-submodule-cray' into release-3.15

Merge-request: !3504
Brad King 6 years ago
parent
commit
14f69fab54
2 changed files with 9 additions and 1 deletions
  1. 2 0
      Modules/Compiler/Cray-Fortran.cmake
  2. 7 1
      Source/cmFortranParserImpl.cxx

+ 2 - 0
Modules/Compiler/Cray-Fortran.cmake

@@ -4,6 +4,8 @@
 include(Compiler/Cray)
 __compiler_cray(Fortran)
 
+set(CMAKE_Fortran_SUBMODULE_SEP "")
+set(CMAKE_Fortran_SUBMODULE_EXT ".mod")
 set(CMAKE_Fortran_MODOUT_FLAG -em)
 set(CMAKE_Fortran_MODDIR_FLAG -J)
 set(CMAKE_Fortran_MODDIR_DEFAULT .)

+ 7 - 1
Source/cmFortranParserImpl.cxx

@@ -79,7 +79,13 @@ std::string cmFortranParser_s::ModName(std::string const& mod_name) const
 std::string cmFortranParser_s::SModName(std::string const& mod_name,
                                         std::string const& sub_name) const
 {
-  return mod_name + this->Compiler.SModSep + sub_name + this->Compiler.SModExt;
+  std::string const& SModExt =
+    this->Compiler.SModExt.empty() ? ".mod" : this->Compiler.SModExt;
+  // An empty separator means that the compiler does not use a prefix.
+  if (this->Compiler.SModSep.empty()) {
+    return sub_name + SModExt;
+  }
+  return mod_name + this->Compiler.SModSep + sub_name + SModExt;
 }
 
 bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname)