added: a dedicated FindCBLAS.cmake rule

the built-in FindBLAS cannot handle CBLAS, and it has only worked by
incident on ubuntu since the libblas available there also includes
libcblas. needed to be portable to other distros

git-svn-id: http://svn.sintef.no/trondheim/IFEM/trunk@1875 e10b68d5-8a6e-419e-a041-bce267b0401d
This commit is contained in:
akva
2012-08-16 15:27:04 +00:00
committed by Knut Morten Okstad
parent 1409a782ec
commit d5249ef63c
2 changed files with 27 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
IF (CBLAS_LIBRARIES)
SET(CBLAS_FIND_QUIETLY TRUE)
ENDIF (CBLAS_LIBRARIES)
FIND_LIBRARY(CBLAS_LIBRARIES
NAMES cblas
PATHS $ENV{HOME}/lib
/usr/lib/atlas/)
IF(NOT CBLAS_LIBRARIES)
FIND_PACKAGE(BLAS)
INCLUDE(CheckFunctionExists)
SET(CMAKE_REQUIRED_LIBRARIES ${BLAS_LIBRARIES})
CHECK_FUNCTION_EXISTS(cblas_dgemm CBLAS_OK)
IF (CBLAS_OK)
SET(CBLAS_LIBRARIES ${BLAS_LIBRARIES})
ENDIF(CBLAS_OK)
ENDIF(NOT CBLAS_LIBRARIES)
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CBLAS DEFAULT_MSG
CBLAS_LIBRARIES)
MARK_AS_ADVANCED(CBLAS_LIBRARIES)

View File

@@ -14,6 +14,7 @@ IF(CMAKE_CXX_COMPILER MATCHES icpc)
ELSE(CMAKE_CXX_COMPILER MATCHES icpc)
SET(IFEM_CXX_FLAGS "${IFEM_CXX_FLAGS} -DUSE_CBLAS")
SET(IFEM_BUILD_CXX_FLAGS "${IFEM_BUILD_CXX_FLAGS} -DUSE_CBLAS")
FIND_PACKAGE(CBLAS REQUIRED)
FIND_PACKAGE(LAPACK REQUIRED)
ENDIF(CMAKE_CXX_COMPILER MATCHES icpc)
@@ -31,7 +32,8 @@ SET(IFEM_DEPLIBS ${IFEM_DEPLIBS}
${GoTrivariate_LIBRARIES}
${GoTools_LIBRARIES}
${ARPACK_LIBRARIES}
${LAPACK_LIBRARIES})
${LAPACK_LIBRARIES}
${CBLAS_LIBRARIES})
SET(IFEM_DEPINCLUDES ${IFEM_DEPINCLUDES}
${GoTools_INCLUDE_DIRS}