Просмотр исходного кода

Fortran: Support compilers using no module prefix on submodule files

Define `CMAKE_Fortran_SUBMODULE_SEP` with an empty string to mean that
the compiler uses no module prefix on its submodule files.

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.
Willem Deconinck 6 лет назад
Родитель
Сommit
33de4d27eb
1 измененных файлов с 7 добавлено и 1 удалено
  1. 7 1
      Source/cmFortranParserImpl.cxx

+ 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 cmFortranParser_s::SModName(std::string const& mod_name,
                                         std::string const& sub_name) const
                                         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)
 bool cmFortranParser_FilePush(cmFortranParser* parser, const char* fname)