Home | History | Annotate | Download | only in cmake
      1 # SPQR lib usually requires linking to a blas and lapack library.
      2 # It is up to the user of this module to find a BLAS and link to it.
      3 
      4 # SPQR lib requires Cholmod, colamd and amd as well. 
      5 # FindCholmod.cmake can be used to find those packages before finding spqr
      6 
      7 if (SPQR_INCLUDES AND SPQR_LIBRARIES)
      8   set(SPQR_FIND_QUIETLY TRUE)
      9 endif (SPQR_INCLUDES AND SPQR_LIBRARIES)
     10 
     11 find_path(SPQR_INCLUDES
     12   NAMES
     13   SuiteSparseQR.hpp
     14   PATHS
     15   $ENV{SPQRDIR}
     16   ${INCLUDE_INSTALL_DIR}
     17   PATH_SUFFIXES
     18   suitesparse
     19   ufsparse
     20 )
     21 
     22 find_library(SPQR_LIBRARIES spqr $ENV{SPQRDIR} ${LIB_INSTALL_DIR})
     23 
     24 if(SPQR_LIBRARIES)
     25 
     26   find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS $ENV{SPQRDIR} ${LIB_INSTALL_DIR})
     27   if (SUITESPARSE_LIBRARY)
     28     set(SPQR_LIBRARIES ${SPQR_LIBRARIES} ${SUITESPARSE_LIBRARY})
     29   endif()
     30 
     31   find_library(CHOLMOD_LIBRARY cholmod PATHS $ENV{UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
     32   if(CHOLMOD_LIBRARY)
     33     set(SPQR_LIBRARIES ${SPQR_LIBRARIES} ${CHOLMOD_LIBRARY})
     34   endif()
     35   
     36 endif(SPQR_LIBRARIES)
     37 
     38 include(FindPackageHandleStandardArgs)
     39 find_package_handle_standard_args(SPQR DEFAULT_MSG SPQR_INCLUDES SPQR_LIBRARIES)
     40 
     41 mark_as_advanced(SPQR_INCLUDES SPQR_LIBRARIES)