找到BLAS给出lib的路径

时间:2015-02-04 11:18:13

标签: cmake lapack blas

我在使用CMake 2.8.9构建的C ++代码中使用了blas / lapack。我想用CMake命令找到BLAS和LAPACK库:

find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)

但它可以找到它,因为库位于特定目录中。错误如下:

CMake Error at /softs/cmake/2.8.9/64/gcc/4.7.2/share/cmake-2.8/Modules/FindBLAS.cmake:594 (message):
A required library with BLAS API not found.  Please specify library

我的问题:我如何指定一条额外的路径来帮助FindBLAS工作,就像我为Boost做的那样(见下文)?

set(PATH_BOOST "/softs/boost/1.53.0/${ARCH}/${COMPILER_NAME}/${COMPILER_VERSION}")
set(BOOST_INCLUDEDIR "${PATH_BOOST}/include")
set(BOOST_LIBRARYDIR "${PATH_BOOST}/lib")
set(Boost_USE_MULTITHREAD ON)
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.53.0 REQUIRED COMPONENTS thread system)

1 个答案:

答案 0 :(得分:5)

您正在寻找BLAS_DIRLAPACK_DIR变量。

set(BLAS_DIR /path/to/blas)
find_package(BLAS REQUIRED)
set(LAPACK_DIR /path/to/lapack)
find_package(LAPACK REQUIRED)