diff options
author | Brad King <brad.king@kitware.com> | 2018-04-18 17:56:01 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-04-20 14:56:54 (GMT) |
commit | 62538b2c4c70eeef52886092e24c97a9a7699a00 (patch) | |
tree | d9e7463225c078105c2879d283191ac7fb14f57d /Source/cmFortranParserImpl.cxx | |
parent | fe0082875aeecead23b2351629abca4990dfba43 (diff) | |
download | CMake-62538b2c4c70eeef52886092e24c97a9a7699a00.zip CMake-62538b2c4c70eeef52886092e24c97a9a7699a00.tar.gz CMake-62538b2c4c70eeef52886092e24c97a9a7699a00.tar.bz2 |
Fortran: Refactor to treat .mod extension as part of module name
When tracking module names internally, include the `.mod` extension.
This will later be useful to distinguish them from `.smod` extensions
for submodules.
Diffstat (limited to 'Source/cmFortranParserImpl.cxx')
-rw-r--r-- | Source/cmFortranParserImpl.cxx | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx index dd4f16b..e4a6ac7 100644 --- a/Source/cmFortranParserImpl.cxx +++ b/Source/cmFortranParserImpl.cxx @@ -168,11 +168,16 @@ void cmFortranParser_Error(cmFortranParser* parser, const char* msg) parser->Error = msg ? msg : "unknown error"; } -void cmFortranParser_RuleUse(cmFortranParser* parser, const char* name) +void cmFortranParser_RuleUse(cmFortranParser* parser, const char* module_name) { - if (!parser->InPPFalseBranch) { - parser->Info.Requires.insert(cmSystemTools::LowerCase(name)); + if (parser->InPPFalseBranch) { + return; } + + // syntax: "use module_name" + // requires: "module_name.mod" + std::string const& mod_name = cmSystemTools::LowerCase(module_name); + parser->Info.Requires.insert(mod_name + ".mod"); } void cmFortranParser_RuleLineDirective(cmFortranParser* parser, @@ -225,10 +230,18 @@ void cmFortranParser_RuleInclude(cmFortranParser* parser, const char* name) } } -void cmFortranParser_RuleModule(cmFortranParser* parser, const char* name) +void cmFortranParser_RuleModule(cmFortranParser* parser, + const char* module_name) { - if (!parser->InPPFalseBranch && !parser->InInterface) { - parser->Info.Provides.insert(cmSystemTools::LowerCase(name)); + if (parser->InPPFalseBranch) { + return; + } + + if (!parser->InInterface) { + // syntax: "module module_name" + // provides: "module_name.mod" + std::string const& mod_name = cmSystemTools::LowerCase(module_name); + parser->Info.Provides.insert(mod_name + ".mod"); } } |