summaryrefslogtreecommitdiffstats
path: root/Source/cmDependsFortran.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-04-19 13:21:58 (GMT)
committerBrad King <brad.king@kitware.com>2018-04-20 14:57:31 (GMT)
commit402735314ec7fe48ec21e5f4c5b19b6f17682c54 (patch)
tree6ad7b1ccfa99d27779cabaa23095bded497a6cfd /Source/cmDependsFortran.cxx
parent62538b2c4c70eeef52886092e24c97a9a7699a00 (diff)
downloadCMake-402735314ec7fe48ec21e5f4c5b19b6f17682c54.zip
CMake-402735314ec7fe48ec21e5f4c5b19b6f17682c54.tar.gz
CMake-402735314ec7fe48ec21e5f4c5b19b6f17682c54.tar.bz2
Fortran: Add support for submodule dependencies
Since commit v3.7.0-rc1~73^2~1 (Fortran: Add support for submodule syntax in dependency scanning, 2016-09-05) we support parsing Fortran sources that use submodule syntax, but it left addition of `.smod` dependencies to future work. Add it now. The syntax submodule (module_name) submodule_name means the current source requires `module_name.mod` and provides `module_name@submodule_name.smod`. The syntax submodule (module_name:submodule_name) nested_submodule_name means the current source requires `module_name@submodule_name.smod` provides `module_name@nested_submodule_name.smod`. Fixes: #17017
Diffstat (limited to 'Source/cmDependsFortran.cxx')
-rw-r--r--Source/cmDependsFortran.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index da644dd..dbea15a 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -31,6 +31,8 @@ static void cmFortranModuleAppendUpperLower(std::string const& mod,
std::string::size_type ext_len = 0;
if (cmHasLiteralSuffix(mod, ".mod")) {
ext_len = 4;
+ } else if (cmHasLiteralSuffix(mod, ".smod")) {
+ ext_len = 5;
}
std::string const& name = mod.substr(0, mod.size() - ext_len);
std::string const& ext = mod.substr(mod.size() - ext_len);
@@ -283,7 +285,8 @@ void cmDependsFortran::MatchRemoteModules(std::istream& fin,
if (line[0] == ' ') {
if (doing_provides) {
std::string mod = line;
- if (!cmHasLiteralSuffix(mod, ".mod")) {
+ if (!cmHasLiteralSuffix(mod, ".mod") &&
+ !cmHasLiteralSuffix(mod, ".smod")) {
// Support fortran.internal files left by older versions of CMake.
// They do not include the ".mod" extension.
mod += ".mod";
@@ -486,7 +489,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
if (args.size() >= 5) {
compilerId = args[4];
}
- if (!cmHasLiteralSuffix(mod, ".mod")) {
+ if (!cmHasLiteralSuffix(mod, ".mod") && !cmHasLiteralSuffix(mod, ".smod")) {
// Support depend.make files left by older versions of CMake.
// They do not include the ".mod" extension.
mod += ".mod";