1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-21 19:33:03 +04:00

cmake: find and link libcblas separately for LAPACK/Generic

On systems like OpenBSD, CBLAS functions are provided by a standalone
libcblas that is not returned by find_package(LAPACK). This caused link
failures when building libopencv_core because cblas_sgemm and friends
from hal_internal.cpp could not be resolved.

Fixes #28768
This commit is contained in:
Samaresh Kumar Singh
2026-04-07 21:24:04 -05:00
committed by Alexander Smorkalov
parent 9eb887d02d
commit 1bef8b81f4
+8 -1
View File
@@ -230,11 +230,18 @@ if(WITH_LAPACK)
find_path(CBLAS_INCLUDE_DIR "cblas.h")
endif()
if(CBLAS_INCLUDE_DIR AND LAPACKE_INCLUDE_DIR)
if(NOT DEFINED CBLAS_LIBRARY)
find_library(CBLAS_LIBRARY cblas)
endif()
set(_lapack_generic_libs "${LAPACK_LIBRARIES}")
if(CBLAS_LIBRARY)
list(APPEND _lapack_generic_libs "${CBLAS_LIBRARY}")
endif()
ocv_lapack_check(IMPL "LAPACK/Generic"
CBLAS_H "cblas.h"
LAPACKE_H "lapacke.h"
INCLUDE_DIR "${CBLAS_INCLUDE_DIR}" "${LAPACKE_INCLUDE_DIR}"
LIBRARIES "${LAPACK_LIBRARIES}")
LIBRARIES "${_lapack_generic_libs}")
elseif(APPLE)
ocv_lapack_check(IMPL "LAPACK/Apple"
CBLAS_H "Accelerate/Accelerate.h"