Skip to content

Fortran: Enable externally if needed for implicit link information

Brad King requested to merge brad.king/cmake:fortran-enable-external into master

When linking a static library whose link interface specifies that Fortran is needed, and Fortran is not enabled, enable Fortran in an external test project to get the implicit link information during generation without affecting the state of the main project.

Since this may require a Fortran compiler to be available where we did not require it previously, add policy CMP0127 for compatibility.

Also add infrastructure to avoid this requirement for the MSVC ABI since Fortran compilers use "pragma comment" in object files to get the Fortran runtime linked automatically.

Edited by Brad King

Merge request reports