cmLocalUnixMakefileGenerator3: handle object-referencing Fortran modules

Targets only using Fortran modules via `$<TARGET_OBJECTS>` also need a
collation step to be performed. Check for this case and trigger the
depends rule to be used.
This commit is contained in:
Ben Boeckel 2023-11-17 22:51:47 -05:00
parent 6afe841e62
commit f8729ab366

View File

@ -1899,6 +1899,11 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
: "OFF")
<< ")\n\n";
bool requireFortran = false;
if (target->HaveFortranSources(this->GetConfigName())) {
requireFortran = true;
}
auto const& implicitLangs =
this->GetImplicitDepends(target, cmDependencyScannerKind::CMake);
@ -1908,6 +1913,12 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo(
cmakefileStream << "set(CMAKE_DEPENDS_LANGUAGES\n";
for (auto const& implicitLang : implicitLangs) {
cmakefileStream << " \"" << implicitLang.first << "\"\n";
if (requireFortran && implicitLang.first == "Fortran"_s) {
requireFortran = false;
}
}
if (requireFortran) {
cmakefileStream << " \"Fortran\"\n";
}
cmakefileStream << " )\n";