From 2c8b5d5f2b2660b7cb6a9918711414d4bbb7d22c Mon Sep 17 00:00:00 2001 From: Bergmann Atmet Date: Wed, 8 Jul 2026 18:23:31 +0300 Subject: [PATCH] try linking against the cblas library before blas `CMakeLists.txt` checks for the cblas header files. But that doesn't cover the linking part. Find and link against the cblas library. Otherwise, try the blas library. Signed-off-by: Bergmann Atmet --- src/CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3a2753b..335708f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -193,8 +193,9 @@ if(APPLE) elseif(TRANSCRIBE_USE_SYSTEM_BLAS) # BLA_VENDOR can be set by the user to prefer a specific BLAS # (e.g. -DBLA_VENDOR=OpenBLAS). find_package probes the system. + find_package(CBLAS QUIET) find_package(BLAS QUIET) - if(BLAS_FOUND) + if(CBLAS_FOUND OR BLAS_FOUND) # find_package(BLAS) may find a Fortran-only BLAS (e.g. libblas3 # on Debian/Ubuntu) that lacks the cblas C wrappers. Verify that # cblas.h exists before enabling; otherwise the build compiles @@ -202,7 +203,12 @@ elseif(TRANSCRIBE_USE_SYSTEM_BLAS) include(CheckIncludeFile) check_include_file(cblas.h HAVE_CBLAS_H) if(HAVE_CBLAS_H) - target_link_libraries(transcribe PRIVATE ${BLAS_LIBRARIES}) + if(CBLAS_FOUND) + target_link_libraries(transcribe PRIVATE ${CBLAS_LIBRARIES}) + elseif(BLAS_FOUND) + target_link_libraries(transcribe PRIVATE ${BLAS_LIBRARIES}) + endif() + target_compile_definitions(transcribe PRIVATE TRANSCRIBE_HAS_BLAS=1) message(STATUS "transcribe: BLAS found — decoder will use cblas_sgemv") else()