Safe-guard against empty directories

CMake will raise an error if you try to remove something from an
unset variable (whereas removing something from an empty list "" is
fine). If the user doesn't have the appropriate library, the search
will turn out empty, and the configuration will fail with a syntax
error instead of a message that the library is not found.
This commit is contained in:
Roland Kaufmann 2013-01-24 13:33:40 +01:00
parent 73c604f541
commit dc92805d9a

View File

@ -150,10 +150,14 @@ foreach (module IN LISTS SuiteSparse_MODULES)
mark_as_advanced (${MODULE}_LIBRARY)
endforeach (module)
list (REMOVE_DUPLICATES SuiteSparse_INCLUDE_DIRS)
list (REVERSE SuiteSparse_LIBRARIES)
list (REMOVE_DUPLICATES SuiteSparse_LIBRARIES)
list (REVERSE SuiteSparse_LIBRARIES)
if (SuiteSparse_INCLUDE_DIRS)
list (REMOVE_DUPLICATES SuiteSparse_INCLUDE_DIRS)
endif (SuiteSparse_INCLUDE_DIRS)
if (SuiteSparse_LIBRARIES)
list (REVERSE SuiteSparse_LIBRARIES)
list (REMOVE_DUPLICATES SuiteSparse_LIBRARIES)
list (REVERSE SuiteSparse_LIBRARIES)
endif (SuiteSparse_LIBRARIES)
# on MacOS X the libraries are in a framework directory and an option must be
# added on the compile line to relate headers to that directory