FindBLAS needs a try_run to test link from Fortran

Having spent 30 minutes in puzzlement over a bad build with segfaulting executables, I would like to propose an enhancement of FindBLAS to check that the BLAS libraries found are ABI-compatible with the Fortran compiler in use.

Scenario - on my development machine I like to have multiple compilers installed for testing. Therefore I need multiple different builds of OpenBLAS, because Fortran compilers differ in their ABI requirements. (Function calls such as zdotc differ in how return values are passed). A mismatch results in an apparently successful but non-functional link, which will crash/give incorrect results at run-time.

I observe that FindBLAS contains code to check the link. This is not sufficient, and I propose that it should also attempt a try_run() to test correct ABI calling sequence for a fortran function not subroutine.

Of course I can include a test compile and run in my CMakelists.txt, but all that can do is abort the configuration step on failure. If this were done within FindBLAS, it could skip over that set of libraries and try another.

Any takers? I will be happy to contribute a test program.

K.R.