diff options
author | Brad King <brad.king@kitware.com> | 2019-02-13 18:34:56 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2019-02-14 15:23:02 (GMT) |
commit | 72057d9c1582f4b6dec66cd0675860c4c335636e (patch) | |
tree | a8ef46af1c9bc0c90f2569393aed93f2b4d0f74f | |
parent | 7ae329e2ed84f62165cb11794ad85c6c43dbd7dc (diff) | |
download | CMake-72057d9c1582f4b6dec66cd0675860c4c335636e.zip CMake-72057d9c1582f4b6dec66cd0675860c4c335636e.tar.gz CMake-72057d9c1582f4b6dec66cd0675860c4c335636e.tar.bz2 |
Fortran: Thread compiler id through to internal Fortran parser
-rw-r--r-- | Source/cmDependsFortran.cxx | 7 | ||||
-rw-r--r-- | Source/cmDependsFortran.h | 2 | ||||
-rw-r--r-- | Source/cmFortranParser.h | 10 | ||||
-rw-r--r-- | Source/cmFortranParserImpl.cxx | 6 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 6 |
5 files changed, 26 insertions, 5 deletions
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx index cae3ff6..fe69d14 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 bf09904..f2d9cf2 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 cc5c113..3fbf552 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 7b0c1a9..8787206 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 6498024..f5262f0 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()); |