linking against Apple's BLAS/LAPACK via intrinsic find modules broken (for Fortran, at least)
How is one supposed to link BLAS/LAPACK on macOS with Fortran projects? In older versions of CMake, one could find_package(BLAS)
... target_link_libraries(<my_target> PUBLIC ${BLAS_LINKER_FLAGS} ${BLAS_LIBRARIES})
.
However, in more recent versions of CMake the only contents of these two variables are BLAD_LIBRARIES
which evaluates to /System/Library/Frameworks/Accelerate.framework
. The generated link line for an executable to link against this is:
/usr/local/bin/gfortran-8 -O3 -DNDEBUG -O3 CMakeFiles/<many, many object files> /System/Library/Frameworks/Accelerate.framework
This command errors with:
ld: can't map file, errno=22 file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk//System/Library/Frameworks/Accelerate.framework' for architecture x86_64
collect2: error: ld returned 1 exit status
I suspect the recent overhaul/updates of FindLAPACK.cmake and FindBLAS.cmake may have broken this.