FindBLAS with FLAME and BLA_STATIC should link to pthreads
Using FindBLAS to find a static copy of BLIS (-DBLA_VENDOR=FLAME -DBLA_STATIC=ON
) fails under some circumstances. Linking to a static copy of BLIS requires linking to pthreads, as there is a reference to pthread_once
in its SGEMM implementation.
My Fortran compiler (AOCC Flang) links to pthreads by default, while my C compiler (AOCC Clang) does not. FindBLAS attempts to link using Fortran when Fortran is enabled, and otherwise attempts to link using C. Thus when the project enables Fortran, Flang is used and the link succeeds; when it does not, Clang is used and the link fails.
FindBLAS should check if BLA_STATIC
is set and, if so, find Threads and add it as a supplementary library. I believe something similar to this is done for e.g. MKL.