Link BLAS explicitly on non-Mac platforms Fixes issue #3.
diff --git a/CMakeLists.txt b/CMakeLists.txt index a8a5c63..70336ae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -145,6 +145,18 @@ ENDIF (NOT EXISTS ${LAPACK_LIB}) MESSAGE ("-- Found LAPACK library: ${LAPACK_LIB}") + # On Apple BLAS is linked with vecLib, so don't add it separately. + IF (NOT APPLE) + MESSAGE("-- Check for BLAS") + FIND_LIBRARY(BLAS_LIB NAMES blas) + IF (NOT EXISTS ${BLAS_LIB}) + MESSAGE(FATAL_ERROR + "Can't find BLAS (needed for LAPACK and SuiteSparse.)" + "Please specify -DBLAS_LIB=...") + ENDIF (NOT EXISTS ${BLAS_LIB}) + MESSAGE ("-- Found BLAS library: ${BLAS_LIB}") + ENDIF (NOT APPLE) + ELSE (SUITESPARSE) ADD_DEFINITIONS(-DCERES_NO_SUITESPARSE) ENDIF (SUITESPARSE)
diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt index 1601666..f02db23 100644 --- a/internal/ceres/CMakeLists.txt +++ b/internal/ceres/CMakeLists.txt
@@ -119,6 +119,12 @@ ${METIS_LIB}) ENDIF (EXISTS ${METIS_LIB}) +IF (EXISTS ${BLAS_LIB}) + SET(CERES_LIBRARY_DEPENDENCIES + ${CERES_LIBRARY_DEPENDENCIES} + ${BLAS_LIB}) +ENDIF (EXISTS ${BLAS_LIB}) + IF (OPENMP_FOUND) SET(CERES_LIBRARY_DEPENDENCIES ${CERES_LIBRARY_DEPENDENCIES}