summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/FindBLAS.cmake19
-rw-r--r--Modules/FindLAPACK.cmake62
2 files changed, 48 insertions, 33 deletions
diff --git a/Modules/FindBLAS.cmake b/Modules/FindBLAS.cmake
index dc9ab37..9d1cf3f 100644
--- a/Modules/FindBLAS.cmake
+++ b/Modules/FindBLAS.cmake
@@ -42,6 +42,8 @@
include(CheckFunctionExists)
include(CheckFortranFunctionExists)
+set(_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+
# Check the language being used
get_property( _LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES )
if( _LANGUAGES_ MATCHES Fortran )
@@ -89,13 +91,18 @@ foreach(_library ${_list})
if(_libraries_work)
if (BLA_STATIC)
if (WIN32)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRRAY_SUFFIXES})
endif ( WIN32 )
if (APPLE)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRRAY_SUFFIXES})
else (APPLE)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRRAY_SUFFIXES})
endif (APPLE)
+ else (BLA_STATIC)
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # for ubuntu's libblas3gf and liblapack3gf packages
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRRAY_SUFFIXES} .so.3gf)
+ endif ()
endif (BLA_STATIC)
find_library(${_prefix}_${_library}_LIBRARY
NAMES ${_library}
@@ -408,7 +415,7 @@ if(NOT BLAS_LIBRARIES)
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
- cblas_dgemm
+ dgemm
""
"Accelerate"
""
@@ -421,7 +428,7 @@ if (BLA_VENDOR STREQUAL "NAS" OR BLA_VENDOR STREQUAL "All")
check_fortran_libraries(
BLAS_LIBRARIES
BLAS
- cblas_dgemm
+ dgemm
""
"vecLib"
""
@@ -613,3 +620,5 @@ else(BLA_F95)
endif(BLAS_FOUND)
endif(NOT BLAS_FIND_QUIETLY)
endif(BLA_F95)
+
+set(CMAKE_FIND_LIBRARY_SUFFIXES ${_blas_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
diff --git a/Modules/FindLAPACK.cmake b/Modules/FindLAPACK.cmake
index 80fe867..240dd97 100644
--- a/Modules/FindLAPACK.cmake
+++ b/Modules/FindLAPACK.cmake
@@ -36,6 +36,8 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+set(_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
+
get_property(_LANGUAGES_ GLOBAL PROPERTY ENABLED_LANGUAGES)
if (NOT _LANGUAGES_ MATCHES Fortran)
include(CheckFunctionExists)
@@ -46,6 +48,8 @@ endif (NOT _LANGUAGES_ MATCHES Fortran)
set(LAPACK_FOUND FALSE)
set(LAPACK95_FOUND FALSE)
+# TODO: move this stuff to separate module
+
macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads)
# This macro checks for the existence of the combination of fortran libraries
# given by _list. If the combination is found, this macro checks (using the
@@ -61,38 +65,38 @@ macro(Check_Lapack_Libraries LIBRARIES _prefix _name _flags _list _blas _threads
set(_libraries_work TRUE)
set(${LIBRARIES})
set(_combined_name)
+if (NOT _libdir)
+ if (WIN32)
+ set(_libdir ENV LIB)
+ elseif (APPLE)
+ set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH)
+ else ()
+ set(_libdir /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH)
+ endif ()
+endif ()
foreach(_library ${_list})
set(_combined_name ${_combined_name}_${_library})
if(_libraries_work)
- IF (WIN32)
- if(BLA_STATIC)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib;.dll")
- endif(BLA_STATIC)
- find_library(${_prefix}_${_library}_LIBRARY
- NAMES ${_library}
- PATHS ENV LIB
- )
- ENDIF (WIN32)
-
- if(APPLE)
- if(BLA_STATIC)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so;.dylib")
- endif(BLA_STATIC)
+ if (BLA_STATIC)
+ if (WIN32)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRRAY_SUFFIXES})
+ endif ( WIN32 )
+ if (APPLE)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .lib ${CMAKE_FIND_LIBRRAY_SUFFIXES})
+ else (APPLE)
+ set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRRAY_SUFFIXES})
+ endif (APPLE)
+ else (BLA_STATIC)
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # for ubuntu's libblas3gf and liblapack3gf packages
+ set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRRAY_SUFFIXES} .so.3gf)
+ endif ()
+ endif (BLA_STATIC)
find_library(${_prefix}_${_library}_LIBRARY
- NAMES ${_library}
- PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV DYLD_LIBRARY_PATH
- )
- else(APPLE)
- if(BLA_STATIC)
- set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
- endif(BLA_STATIC)
- find_library(${_prefix}_${_library}_LIBRARY
- NAMES ${_library}
- PATHS /usr/local/lib /usr/lib /usr/local/lib64 /usr/lib64 ENV LD_LIBRARY_PATH
- )
- endif(APPLE)
-
+ NAMES ${_library}
+ PATHS ${_libdir}
+ )
mark_as_advanced(${_prefix}_${_library}_LIBRARY)
set(${LIBRARIES} ${${LIBRARIES}} ${${_prefix}_${_library}_LIBRARY})
set(_libraries_work ${${_prefix}_${_library}_LIBRARY})
@@ -165,7 +169,7 @@ endif (BLA_VENDOR STREQUAL "Goto" OR BLA_VENDOR STREQUAL "All")
#acml lapack
- if (BLA_VENDOR STREQUAL "ACML.*" OR BLA_VENDOR STREQUAL "All")
+ if (BLA_VENDOR MATCHES "ACML.*" OR BLA_VENDOR STREQUAL "All")
if (BLAS_LIBRARIES MATCHES ".+acml.+")
set (LAPACK_LIBRARIES ${BLAS_LIBRARIES})
endif ()
@@ -297,3 +301,5 @@ else(BLA_F95)
endif(LAPACK_FOUND)
endif(NOT LAPACK_FIND_QUIETLY)
endif(BLA_F95)
+
+set(CMAKE_FIND_LIBRARY_SUFFIXES ${_lapack_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})