From d00cff8549cc34527ff23fe9d3519f805b68ecd0 Mon Sep 17 00:00:00 2001 From: Roland Kaufmann Date: Thu, 12 Sep 2013 09:38:25 +0200 Subject: [PATCH] Don't set a default search path; use CMake's default If we set a default search path ourself, then this will be used if we specify a SuiteSparse_ROOT with error! Instead, we should just leave our SuiteSparse_SEARCH_PATH variable empty and then let CMake fill in its defaults. If there is a directory specified on the other hand (indicating that we want exactly that location), only use that and turn all the default paths completely off. --- cmake/Modules/FindSuiteSparse.cmake | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cmake/Modules/FindSuiteSparse.cmake b/cmake/Modules/FindSuiteSparse.cmake index 6d34664d8..a232635ee 100644 --- a/cmake/Modules/FindSuiteSparse.cmake +++ b/cmake/Modules/FindSuiteSparse.cmake @@ -72,37 +72,36 @@ endif (NOT LAPACK_FOUND) find_library (MATH_LIBRARY NAMES "m") set (SuiteSparse_EXTRA_LIBS ${LAPACK_LIBRARIES} ${BLAS_LIBRARIES} ${MATH_LIBRARY}) -# search paths for the library outside of standard system paths. these are the -# paths in which the package managers on various distros put the files -list (APPEND SuiteSparse_SEARCH_PATH "/usr") # Linux -list (APPEND SuiteSparse_SEARCH_PATH "/opt/local") # MacOS X - # if we don't get any further clues about where to look, then start # roaming around the system set (_no_default_path "") +# search system directories by default +set (SuiteSparse_SEARCH_PATH) + # pick up paths from the environment if specified there; these replace the # pre-defined paths so that we don't accidentially pick up old stuff if (NOT $ENV{SuiteSparse_DIR} STREQUAL "") set (SuiteSparse_SEARCH_PATH "$ENV{SuiteSparse_DIR}") - set (_no_default_path "NO_DEFAULT_PATH") endif (NOT $ENV{SuiteSparse_DIR} STREQUAL "") if (SuiteSparse_DIR) set (SuiteSparse_SEARCH_PATH "${SuiteSparse_DIR}") - set (_no_default_path "NO_DEFAULT_PATH") endif (SuiteSparse_DIR) # CMake uses _DIR suffix as default for config-mode files; it is unlikely # that we are building SuiteSparse ourselves; use _ROOT suffix to specify # location to pre-canned binaries if (NOT $ENV{SuiteSparse_ROOT} STREQUAL "") set (SuiteSparse_SEARCH_PATH "$ENV{SuiteSparse_ROOT}") - set (_no_default_path "NO_DEFAULT_PATH") endif (NOT $ENV{SuiteSparse_ROOT} STREQUAL "") if (SuiteSparse_ROOT) set (SuiteSparse_SEARCH_PATH "${SuiteSparse_ROOT}") - set (_no_default_path "NO_DEFAULT_PATH") endif (SuiteSparse_ROOT) +# if we have specified a search path, then confine ourselves to that +if (SuiteSparse_SEARCH_PATH) + set (_no_default_path "NO_DEFAULT_PATH") +endif (SuiteSparse_SEARCH_PATH) + # transitive closure of dependencies; after this SuiteSparse_MODULES is the # full list of modules that must be found to satisfy the user's link demands set (SuiteSparse_MODULES ${SuiteSparse_FIND_COMPONENTS})