MCPcopy Create free account
hub / github.com/Kitware/CMake / GetTargetFortranFlags

Method GetTargetFortranFlags

Source/cmLocalCommonGenerator.cxx:43–94  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43std::string cmLocalCommonGenerator::GetTargetFortranFlags(
44 cmGeneratorTarget const* target, std::string const& config)
45{
46 std::string flags;
47
48 // Enable module output if necessary.
49 this->AppendFlags(
50 flags, this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODOUT_FLAG"));
51
52 // Add a module output directory flag if necessary.
53 std::string mod_dir =
54 target->GetFortranModuleDirectory(this->GetWorkingDirectory());
55 if (!mod_dir.empty()) {
56 mod_dir = this->ConvertToOutputFormat(
57 this->MaybeRelativeToWorkDir(mod_dir), cmOutputConverter::SHELL);
58 } else {
59 mod_dir =
60 this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_DEFAULT");
61 }
62 if (!mod_dir.empty()) {
63 std::string modflag = cmStrCat(
64 this->Makefile->GetRequiredDefinition("CMAKE_Fortran_MODDIR_FLAG"),
65 mod_dir);
66 this->AppendFlags(flags, modflag);
67 // Some compilers do not search their own module output directory
68 // for using other modules. Add an include directory explicitly
69 // for consistency with compilers that do search it.
70 std::string incflag =
71 this->Makefile->GetSafeDefinition("CMAKE_Fortran_MODDIR_INCLUDE_FLAG");
72 if (!incflag.empty()) {
73 incflag = cmStrCat(incflag, mod_dir);
74 this->AppendFlags(flags, incflag);
75 }
76 }
77
78 // If there is a separate module path flag then duplicate the
79 // include path with it. This compiler does not search the include
80 // path for modules.
81 if (cmValue modpath_flag =
82 this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) {
83 std::vector<std::string> includes;
84 this->GetIncludeDirectories(includes, target, "C", config);
85 for (std::string const& id : includes) {
86 std::string flg =
87 cmStrCat(*modpath_flag,
88 this->ConvertToOutputFormat(id, cmOutputConverter::SHELL));
89 this->AppendFlags(flags, flg);
90 }
91 }
92
93 return flags;
94}
95
96std::string cmLocalCommonGenerator::ComputeLongTargetDirectory(
97 cmGeneratorTarget const* target) const

Callers

nothing calls this directly

Calls 9

cmStrCatFunction · 0.70
AppendFlagsMethod · 0.45
GetWorkingDirectoryMethod · 0.45
emptyMethod · 0.45
ConvertToOutputFormatMethod · 0.45
GetDefinitionMethod · 0.45
GetIncludeDirectoriesMethod · 0.45

Tested by

no test coverage detected