FortranCInterface: Fix compatibility with GCC gfortran 12 LTO

Since version 12.0 the GCC Fortran compiler has implemented "WG5/N1942",
which causes, if link-time opmization is enabled, obfuscation of hard-coded
string values in the compiler objects and its resulting ELF-binaries.

This causes the CMake-internal detection of the mangling scheme for the
naming of subroutines to fail.  Thus we must ensure to have any link-time
optimization features to be disabled on the executable file we perform the
detection on.

The static libraries, however, must be build with LTO and non-LTO objects,
as that will ensure the verify step will operate on IPO objects, if building
those is requested by the system compiler flags.

Fixes: #23123

Signed-off-by: Björn Esser <besser82@fedoraproject.org>
40 jobs for !6879 with topic/besser82/gcc12_gfortran_lto in 28 minutes and 20 seconds (queued for 3 seconds)
merge request