Commit b3790796 authored by Javier Martín's avatar Javier Martín Committed by Brad King
Browse files

VS: Use .vfproj utility targets in Fortran-only projects

For CMake projects in which only Fortran has been enabled, make the VS
generator create the "support" VS projects (`INSTALL`, `ZERO_CHECK`,
etc.) as Fortran projects (`.vfproj`) instead of Visual C/C++ projects
(`.vcproj`).

Fixes: #16719
parent a5931b61
Pipeline #51320 passed with stage
......@@ -735,6 +735,25 @@ bool cmGlobalVisualStudioGenerator::TargetIsFortranOnly(
if (*languages.begin() == "Fortran") {
return true;
}
} else if (languages.empty()) {
// For "language-less" targets (e.g. ALL_BUILD), check if Fortran is the
// only language enabled for this project (other than RC).
if (!this->GetLanguageEnabled("Fortran")) {
return false;
}
std::vector<std::string> enabled, accepted;
accepted.push_back("Fortran");
accepted.push_back("RC"); // Note: add in sorted order!
this->GetEnabledLanguages(enabled);
std::sort(enabled.begin(), enabled.end());
// True if accepted includes enabled, that is, if the set of enabled
// languages has no other elements than the accepted ones.
if (std::includes(accepted.begin(), accepted.end(), enabled.begin(),
enabled.end())) {
return true;
}
}
return false;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment