aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmake/FindUMFPACK.cmake
diff options
context:
space:
mode:
authorGravatar Antonio Sanchez <cantonios@google.com>2021-02-23 20:16:52 -0800
committerGravatar David Tellenbach <david.tellenbach@me.com>2021-02-24 09:52:05 +0000
commit119763cf38093ddc82ae2a9d644e3d975148d908 (patch)
treefa66b216fe2c07c537b795b1b8b234bcb8ede58b /cmake/FindUMFPACK.cmake
parent6cf0ab5e99c27cb7b128e55991fbad5a7d234c8e (diff)
Eliminate CMake FindPackageHandleStandardArgs warnings.
CMake complains that the package name does not match when the case differs, e.g.: ``` CMake Warning (dev) at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:273 (message): The package name passed to `find_package_handle_standard_args` (UMFPACK) does not match the name of the calling package (Umfpack). This can lead to problems in calling code that expects `find_package` result variables (e.g., `_FOUND`) to follow a certain pattern. Call Stack (most recent call first): cmake/FindUmfpack.cmake:50 (find_package_handle_standard_args) bench/spbench/CMakeLists.txt:24 (find_package) This warning is for project developers. Use -Wno-dev to suppress it. ``` Here we rename the libraries to match their true cases.
Diffstat (limited to 'cmake/FindUMFPACK.cmake')
-rw-r--r--cmake/FindUMFPACK.cmake53
1 files changed, 53 insertions, 0 deletions
diff --git a/cmake/FindUMFPACK.cmake b/cmake/FindUMFPACK.cmake
new file mode 100644
index 000000000..91cf6372f
--- /dev/null
+++ b/cmake/FindUMFPACK.cmake
@@ -0,0 +1,53 @@
+# Umfpack lib usually requires linking to a blas library.
+# It is up to the user of this module to find a BLAS and link to it.
+
+if (UMFPACK_INCLUDES AND UMFPACK_LIBRARIES)
+ set(UMFPACK_FIND_QUIETLY TRUE)
+endif ()
+
+find_path(UMFPACK_INCLUDES
+ NAMES
+ umfpack.h
+ PATHS
+ $ENV{UMFPACKDIR}
+ ${INCLUDE_INSTALL_DIR}
+ PATH_SUFFIXES
+ suitesparse
+ ufsparse
+)
+
+find_library(UMFPACK_LIBRARIES umfpack PATHS $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
+
+if(UMFPACK_LIBRARIES)
+
+ if(NOT UMFPACK_LIBDIR)
+ get_filename_component(UMFPACK_LIBDIR ${UMFPACK_LIBRARIES} PATH)
+ endif()
+
+ find_library(COLAMD_LIBRARY colamd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
+ if(COLAMD_LIBRARY)
+ set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${COLAMD_LIBRARY})
+ endif ()
+
+ find_library(AMD_LIBRARY amd PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
+ if(AMD_LIBRARY)
+ set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${AMD_LIBRARY})
+ endif ()
+
+ find_library(SUITESPARSE_LIBRARY SuiteSparse PATHS ${UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
+ if(SUITESPARSE_LIBRARY)
+ set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${SUITESPARSE_LIBRARY})
+ endif ()
+
+ find_library(CHOLMOD_LIBRARY cholmod PATHS $ENV{UMFPACK_LIBDIR} $ENV{UMFPACKDIR} ${LIB_INSTALL_DIR})
+ if(CHOLMOD_LIBRARY)
+ set(UMFPACK_LIBRARIES ${UMFPACK_LIBRARIES} ${CHOLMOD_LIBRARY})
+ endif()
+
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(UMFPACK DEFAULT_MSG
+ UMFPACK_INCLUDES UMFPACK_LIBRARIES)
+
+mark_as_advanced(UMFPACK_INCLUDES UMFPACK_LIBRARIES AMD_LIBRARY COLAMD_LIBRARY CHOLMOD_LIBRARY SUITESPARSE_LIBRARY)