summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/cmDependsFortran.cxx7
-rw-r--r--Source/cmDependsFortran.h2
-rw-r--r--Source/cmFortranParser.h10
-rw-r--r--Source/cmFortranParserImpl.cxx6
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx6
5 files changed, 26 insertions, 5 deletions
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index cae3ff600a..fe69d146e7 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -94,6 +94,8 @@ cmDependsFortran::cmDependsFortran(cmLocalGenerator* lg)
}
this->PPDefinitions.insert(def);
}
+
+ this->CompilerId = mf->GetSafeDefinition("CMAKE_Fortran_COMPILER_ID");
}
cmDependsFortran::~cmDependsFortran()
@@ -116,6 +118,9 @@ bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources,
return false;
}
+ cmFortranCompiler fc;
+ fc.Id = this->CompilerId;
+
bool okay = true;
for (std::string const& src : sources) {
// Get the information object for this source.
@@ -123,7 +128,7 @@ bool cmDependsFortran::WriteDependencies(const std::set<std::string>& sources,
// Create the parser object. The constructor takes info by reference,
// so we may look into the resulting objects later.
- cmFortranParser parser(this->IncludePath, this->PPDefinitions, info);
+ cmFortranParser parser(fc, this->IncludePath, this->PPDefinitions, info);
// Push on the starting file.
cmFortranParser_FilePush(&parser, src.c_str());
diff --git a/Source/cmDependsFortran.h b/Source/cmDependsFortran.h
index bf09904716..f2d9cf2d2e 100644
--- a/Source/cmDependsFortran.h
+++ b/Source/cmDependsFortran.h
@@ -77,6 +77,8 @@ protected:
// The source file from which to start scanning.
std::string SourceFile;
+ std::string CompilerId;
+
std::set<std::string> PPDefinitions;
// Internal implementation details.
diff --git a/Source/cmFortranParser.h b/Source/cmFortranParser.h
index cc5c1131d6..3fbf5526fb 100644
--- a/Source/cmFortranParser.h
+++ b/Source/cmFortranParser.h
@@ -128,9 +128,14 @@ struct cmFortranFile
bool LastCharWasNewline;
};
+struct cmFortranCompiler
+{
+ std::string Id;
+};
+
struct cmFortranParser_s
{
- cmFortranParser_s(std::vector<std::string> includes,
+ cmFortranParser_s(cmFortranCompiler fc, std::vector<std::string> includes,
std::set<std::string> defines, cmFortranSourceInfo& info);
~cmFortranParser_s();
@@ -141,6 +146,9 @@ struct cmFortranParser_s
std::string SModName(std::string const& mod_name,
std::string const& sub_name) const;
+ // What compiler.
+ cmFortranCompiler Compiler;
+
// The include file search path.
std::vector<std::string> IncludePath;
diff --git a/Source/cmFortranParserImpl.cxx b/Source/cmFortranParserImpl.cxx
index 7b0c1a958f..8787206f37 100644
--- a/Source/cmFortranParserImpl.cxx
+++ b/Source/cmFortranParserImpl.cxx
@@ -43,10 +43,12 @@ bool cmFortranParser_s::FindIncludeFile(const char* dir,
return false;
}
-cmFortranParser_s::cmFortranParser_s(std::vector<std::string> includes,
+cmFortranParser_s::cmFortranParser_s(cmFortranCompiler fc,
+ std::vector<std::string> includes,
std::set<std::string> defines,
cmFortranSourceInfo& info)
- : IncludePath(std::move(includes))
+ : Compiler(std::move(fc))
+ , IncludePath(std::move(includes))
, PPDefinitions(std::move(defines))
, Info(info)
{
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 64980245d2..f5262f0aa5 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -1679,6 +1679,7 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
return 1;
}
+ cmFortranCompiler fc;
std::vector<std::string> includes;
{
Json::Value tdio;
@@ -1700,11 +1701,14 @@ int cmcmd_cmake_ninja_depends(std::vector<std::string>::const_iterator argBeg,
includes.push_back(tdi_include_dir.asString());
}
}
+
+ Json::Value const& tdi_compiler_id = tdi["compiler-id"];
+ fc.Id = tdi_compiler_id.asString();
}
cmFortranSourceInfo info;
std::set<std::string> defines;
- cmFortranParser parser(includes, defines, info);
+ cmFortranParser parser(fc, includes, defines, info);
if (!cmFortranParser_FilePush(&parser, arg_pp.c_str())) {
cmSystemTools::Error("-E cmake_ninja_depends failed to open ",
arg_pp.c_str());