summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWillem Deconinck <willem.deconinck@ecmwf.int>2019-07-02 09:10:26 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-08 15:28:27 (GMT)
commit33de4d27eb5686bc5b3f9eb96cadf3e4a30084dc (patch)
treee8a86db570c6ff8aa7b11d448579c3cbffd1d5c5
parent753373579e3dd8cf19f0fc18f4d9bec43a2d82e8 (diff)
downloadCMake-33de4d27eb5686bc5b3f9eb96cadf3e4a30084dc.zip
CMake-33de4d27eb5686bc5b3f9eb96cadf3e4a30084dc.tar.gz
CMake-33de4d27eb5686bc5b3f9eb96cadf3e4a30084dc.tar.bz2
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.
-rw-r--r--Source/cmFortranParserImpl.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx
index 18e3c10..e8b1da8 100644
--- a/Source/cmFortranParserImpl.cxx
+++ b/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)