CMake 在 windows 上找不到 LAPACK 库

CMake can not find LAPACK library on windows

我正在尝试使用 CMake 构建一个 C++ 项目,其中包括 LAPACK 库win32系统.

跟随纪录片LAPACK for windows

我安装了MinGW 32位,在路径中添加了"C:\MinGW\bin", 然后将下载的预建库:libblas.lib、libblas.dll、liblapack.lib、liblapack.dll放在路径中 “\projectRootrdparty\LAPACK”

文件夹结构如下:

\projectRoot
    \CMakeLists.txt
    rdparty
         \LAPACK
             libblas.lib
             ...

在 CMakeLists 文件中,我添加了

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 by

的配置模式
set(LAPACK_DIR "dir/to/lapacklibs")
find_package(LAPACK CONFIG REQUIRED)