我正在尝试使用CMake构建一个C++项目,其中包括win32系统上的LAPACK 库。
继纪录片《窗户的LAPACK》之后,
我安装了 MinGW 32 位并在路径中添加了"C:\MinGW\bin", 然后将下载的预构建库:libblas.lib,libblas.dll,liblapack.lib,liblapack.dll放在路径中 "\projectRoot\3rdparty\LAPACK">
文件夹的结构如下:
projectRoot
CMakeLists.txt
3rdparty
LAPACK
libblas.lib
...
在 CMakeList 文件中,我添加了
set(LAPACK_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/LAPACK")
find_package(LAPACK REQUIRED)
但出现错误:
CMake Error at C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Call Stack (most recent call first):
C:/Program Files/CMake/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
C:/Program Files/CMake/share/cmake-3.16/Modules/FindBLAS.cmake:810 (find_package_handle_standard_args)
C:/Program Files/CMake/share/cmake-3.16/Modules/FindLAPACK.cmake:197 (find_package)
CMakeLists.txt:17 (find_package)
在错误出现之前,CMake 找不到一些东西
Looking for sgemm_
Looking for sgemm_ - not found
Looking for pthread.h
Looking for pthread.h - not found
Found Threads: TRUE
我无法弄清楚问题的原因是什么。
如果您可以分享您的经验,请提前感谢您。
回答我自己的问题。
最后,我找到包裹的是:
从jlblancoc/suitesparse-metis-for-windows复制构建版本, 然后使用find_package的配置模式
set(LAPACK_DIR "dir/to/lapacklibs")
find_package(LAPACK CONFIG REQUIRED)