mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-11-26 01:48:59 +08:00
228 lines
9.0 KiB
Diff
228 lines
9.0 KiB
Diff
--- a/cmake/FindSuiteSparse.cmake Mon Feb 06 18:05:05 2017
|
|
+++ b/cmake/FindSuiteSparse.cmake Fri Jul 07 02:13:31 2017
|
|
@@ -152,6 +152,12 @@
|
|
# the first.
|
|
endmacro(SUITESPARSE_REPORT_NOT_FOUND)
|
|
|
|
+# Protect against any alternative find_package scripts for this library having
|
|
+# been called previously (in a client project) which set SUITESPARSE_FOUND, but
|
|
+# not the other variables we require / set here which could cause the search
|
|
+# logic here to fail.
|
|
+unset(SUITESPARSE_FOUND)
|
|
+
|
|
# Handle possible presence of lib prefix for libraries on MSVC, see
|
|
# also SUITESPARSE_RESET_FIND_LIBRARY_PREFIX().
|
|
if (MSVC)
|
|
@@ -173,8 +179,6 @@
|
|
/opt/local/include/ufsparse # Mac OS X
|
|
/usr/local/homebrew/include # Mac OS X
|
|
/usr/local/include
|
|
- /usr/local/include/suitesparse
|
|
- /usr/include/suitesparse # Ubuntu
|
|
/usr/include)
|
|
list(APPEND SUITESPARSE_CHECK_LIBRARY_DIRS
|
|
${SUITESPARSE_LIBRARY_DIR_HINTS}
|
|
@@ -182,9 +186,10 @@
|
|
/opt/local/lib/ufsparse # Mac OS X
|
|
/usr/local/homebrew/lib # Mac OS X
|
|
/usr/local/lib
|
|
- /usr/local/lib/suitesparse
|
|
- /usr/lib/suitesparse # Ubuntu
|
|
/usr/lib)
|
|
+# Additional suffixes to try appending to each search path.
|
|
+list(APPEND SUITESPARSE_CHECK_PATH_SUFFIXES
|
|
+ suitesparse) # Windows/Ubuntu
|
|
|
|
# Given the number of components of SuiteSparse, and to ensure that the
|
|
# automatic failure message generated by FindPackageHandleStandardArgs()
|
|
@@ -212,7 +217,8 @@
|
|
set(AMD_FOUND TRUE)
|
|
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS AMD_FOUND)
|
|
find_library(AMD_LIBRARY NAMES amd
|
|
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${AMD_LIBRARY})
|
|
message(STATUS "Found AMD library: ${AMD_LIBRARY}")
|
|
else (EXISTS ${AMD_LIBRARY})
|
|
@@ -223,7 +229,8 @@
|
|
mark_as_advanced(AMD_LIBRARY)
|
|
|
|
find_path(AMD_INCLUDE_DIR NAMES amd.h
|
|
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${AMD_INCLUDE_DIR})
|
|
message(STATUS "Found AMD header in: ${AMD_INCLUDE_DIR}")
|
|
else (EXISTS ${AMD_INCLUDE_DIR})
|
|
@@ -237,7 +244,8 @@
|
|
set(CAMD_FOUND TRUE)
|
|
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CAMD_FOUND)
|
|
find_library(CAMD_LIBRARY NAMES camd
|
|
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${CAMD_LIBRARY})
|
|
message(STATUS "Found CAMD library: ${CAMD_LIBRARY}")
|
|
else (EXISTS ${CAMD_LIBRARY})
|
|
@@ -248,7 +256,8 @@
|
|
mark_as_advanced(CAMD_LIBRARY)
|
|
|
|
find_path(CAMD_INCLUDE_DIR NAMES camd.h
|
|
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${CAMD_INCLUDE_DIR})
|
|
message(STATUS "Found CAMD header in: ${CAMD_INCLUDE_DIR}")
|
|
else (EXISTS ${CAMD_INCLUDE_DIR})
|
|
@@ -262,7 +271,8 @@
|
|
set(COLAMD_FOUND TRUE)
|
|
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS COLAMD_FOUND)
|
|
find_library(COLAMD_LIBRARY NAMES colamd
|
|
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${COLAMD_LIBRARY})
|
|
message(STATUS "Found COLAMD library: ${COLAMD_LIBRARY}")
|
|
else (EXISTS ${COLAMD_LIBRARY})
|
|
@@ -273,7 +283,8 @@
|
|
mark_as_advanced(COLAMD_LIBRARY)
|
|
|
|
find_path(COLAMD_INCLUDE_DIR NAMES colamd.h
|
|
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${COLAMD_INCLUDE_DIR})
|
|
message(STATUS "Found COLAMD header in: ${COLAMD_INCLUDE_DIR}")
|
|
else (EXISTS ${COLAMD_INCLUDE_DIR})
|
|
@@ -287,7 +298,8 @@
|
|
set(CCOLAMD_FOUND TRUE)
|
|
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CCOLAMD_FOUND)
|
|
find_library(CCOLAMD_LIBRARY NAMES ccolamd
|
|
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${CCOLAMD_LIBRARY})
|
|
message(STATUS "Found CCOLAMD library: ${CCOLAMD_LIBRARY}")
|
|
else (EXISTS ${CCOLAMD_LIBRARY})
|
|
@@ -298,7 +310,8 @@
|
|
mark_as_advanced(CCOLAMD_LIBRARY)
|
|
|
|
find_path(CCOLAMD_INCLUDE_DIR NAMES ccolamd.h
|
|
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${CCOLAMD_INCLUDE_DIR})
|
|
message(STATUS "Found CCOLAMD header in: ${CCOLAMD_INCLUDE_DIR}")
|
|
else (EXISTS ${CCOLAMD_INCLUDE_DIR})
|
|
@@ -312,7 +325,8 @@
|
|
set(CHOLMOD_FOUND TRUE)
|
|
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS CHOLMOD_FOUND)
|
|
find_library(CHOLMOD_LIBRARY NAMES cholmod
|
|
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${CHOLMOD_LIBRARY})
|
|
message(STATUS "Found CHOLMOD library: ${CHOLMOD_LIBRARY}")
|
|
else (EXISTS ${CHOLMOD_LIBRARY})
|
|
@@ -323,7 +337,8 @@
|
|
mark_as_advanced(CHOLMOD_LIBRARY)
|
|
|
|
find_path(CHOLMOD_INCLUDE_DIR NAMES cholmod.h
|
|
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${CHOLMOD_INCLUDE_DIR})
|
|
message(STATUS "Found CHOLMOD header in: ${CHOLMOD_INCLUDE_DIR}")
|
|
else (EXISTS ${CHOLMOD_INCLUDE_DIR})
|
|
@@ -337,7 +352,8 @@
|
|
set(SUITESPARSEQR_FOUND TRUE)
|
|
list(APPEND SUITESPARSE_FOUND_REQUIRED_VARS SUITESPARSEQR_FOUND)
|
|
find_library(SUITESPARSEQR_LIBRARY NAMES spqr
|
|
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${SUITESPARSEQR_LIBRARY})
|
|
message(STATUS "Found SuiteSparseQR library: ${SUITESPARSEQR_LIBRARY}")
|
|
else (EXISTS ${SUITESPARSEQR_LIBRARY})
|
|
@@ -348,7 +364,8 @@
|
|
mark_as_advanced(SUITESPARSEQR_LIBRARY)
|
|
|
|
find_path(SUITESPARSEQR_INCLUDE_DIR NAMES SuiteSparseQR.hpp
|
|
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${SUITESPARSEQR_INCLUDE_DIR})
|
|
message(STATUS "Found SuiteSparseQR header in: ${SUITESPARSEQR_INCLUDE_DIR}")
|
|
else (EXISTS ${SUITESPARSEQR_INCLUDE_DIR})
|
|
@@ -364,7 +381,8 @@
|
|
# support for it, this will do no harm if it wasn't.
|
|
set(TBB_FOUND TRUE)
|
|
find_library(TBB_LIBRARIES NAMES tbb
|
|
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${TBB_LIBRARIES})
|
|
message(STATUS "Found Intel Thread Building Blocks (TBB) library: "
|
|
"${TBB_LIBRARIES}, assuming SuiteSparseQR was compiled with TBB.")
|
|
@@ -377,7 +395,8 @@
|
|
|
|
if (TBB_FOUND)
|
|
find_library(TBB_MALLOC_LIB NAMES tbbmalloc
|
|
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${TBB_MALLOC_LIB})
|
|
message(STATUS "Found Intel Thread Building Blocks (TBB) Malloc library: "
|
|
"${TBB_MALLOC_LIB}")
|
|
@@ -407,7 +426,8 @@
|
|
# If SuiteSparse version is >= 4 then SuiteSparse_config is required.
|
|
# For SuiteSparse 3, UFconfig.h is required.
|
|
find_library(SUITESPARSE_CONFIG_LIBRARY NAMES suitesparseconfig
|
|
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${SUITESPARSE_CONFIG_LIBRARY})
|
|
message(STATUS "Found SuiteSparse_config library: "
|
|
"${SUITESPARSE_CONFIG_LIBRARY}")
|
|
@@ -415,7 +435,8 @@
|
|
mark_as_advanced(SUITESPARSE_CONFIG_LIBRARY)
|
|
|
|
find_path(SUITESPARSE_CONFIG_INCLUDE_DIR NAMES SuiteSparse_config.h
|
|
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${SUITESPARSE_CONFIG_INCLUDE_DIR})
|
|
message(STATUS "Found SuiteSparse_config header in: "
|
|
"${SUITESPARSE_CONFIG_INCLUDE_DIR}")
|
|
@@ -433,7 +454,8 @@
|
|
# does not have librt).
|
|
if (CMAKE_SYSTEM_NAME MATCHES "Linux" OR UNIX AND NOT APPLE)
|
|
find_library(LIBRT_LIBRARY NAMES rt
|
|
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (LIBRT_LIBRARY)
|
|
message(STATUS "Adding librt: ${LIBRT_LIBRARY} to "
|
|
"SuiteSparse_config libraries (required on Linux & Unix [not OSX] if "
|
|
@@ -452,7 +474,8 @@
|
|
# UFconfig header which should be present in < v4 installs.
|
|
set(SUITESPARSE_CONFIG_FOUND FALSE)
|
|
find_path(UFCONFIG_INCLUDE_DIR NAMES UFconfig.h
|
|
- PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_INCLUDE_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${UFCONFIG_INCLUDE_DIR})
|
|
message(STATUS "Found UFconfig header in: ${UFCONFIG_INCLUDE_DIR}")
|
|
set(UFCONFIG_FOUND TRUE)
|
|
@@ -543,7 +566,8 @@
|
|
|
|
# METIS (Optional dependency).
|
|
find_library(METIS_LIBRARY NAMES metis
|
|
- PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS})
|
|
+ PATHS ${SUITESPARSE_CHECK_LIBRARY_DIRS}
|
|
+ PATH_SUFFIXES ${SUITESPARSE_CHECK_PATH_SUFFIXES})
|
|
if (EXISTS ${METIS_LIBRARY})
|
|
message(STATUS "Found METIS library: ${METIS_LIBRARY}.")
|
|
set(METIS_FOUND TRUE)
|