CMake: add WITH_SYSTEM_SUPERLU option

Fixes crash on Linux (reported multiple times): see #1021
This commit is contained in:
Campbell Barton 2017-02-10 09:51:07 +11:00
parent dde44fa941
commit cead1bb2ca
2 changed files with 39 additions and 7 deletions

View file

@ -1,13 +1,37 @@
# preferred homebrew's directories.
if(WITH_SYSTEM_SUPERLU)
# depend on CMake's defaults
set(_header_hints)
set(_header_suffixes
superlu
)
set(_lib_suffixes)
else()
# preferred homebrew's directories.
set(_header_hints
${THIRDPARTY_LIBS_HINTS}
)
set(_header_suffixes
superlu43/4.3_1/include/superlu
superlu/SuperLU_4.1/include
)
set(_lib_hints
${THIRDPARTY_LIBS_HINTS}
)
set(_lib_suffixes
lzo/2.09/lib
lzo/2.03/lib/LZO_lib
)
endif()
find_path(
SUPERLU_INCLUDE_DIR
NAMES
slu_Cnames.h
HINTS
${THIRDPARTY_LIBS_HINTS}
${_header_hints}
PATH_SUFFIXES
superlu43/4.3_1/include/superlu
superlu/SuperLU_4.1/include
${_header_suffixes}
)
find_library(
@ -17,10 +41,9 @@ find_library(
libsuperlu.a
libsuperlu_4.1.a
HINTS
${THIRDPARTY_LIBS_HINTS}
${_lib_hints}
PATH_SUFFIXES
superlu43/4.3_1/lib
superlu
${_lib_suffixes}
)
message("***** SuperLU Header path:" ${SUPERLU_INCLUDE_DIR})
@ -40,3 +63,8 @@ mark_as_advanced(
SUPERLU_LIBRARY
SUPERLU_INCLUDE_DIR
)
unset(_header_hints)
unset(_header_suffixes)
unset(_lib_hints)
unset(_lib_suffixes)

View file

@ -37,10 +37,13 @@ option_defaults_init(
# customize...
if(WIN32)
set(_init_SYSTEM_LZO OFF)
set(_init_SYSTEM_SUPERLU OFF)
elseif(APPLE)
set(_init_SYSTEM_LZO OFF)
set(_init_SYSTEM_SUPERLU OFF)
elseif(UNIX)
set(_init_SYSTEM_LZO ON)
set(_init_SYSTEM_SUPERLU ON)
endif()
@ -48,6 +51,7 @@ endif()
# Build Options
option(WITH_SYSTEM_LZO "Use the system LZO library instead of 'thirdpary'" ${_init_SYSTEM_LZO})
option(WITH_SYSTEM_SUPERLU "Use the system SuperLU library instead of 'thirdpary'" ${_init_SYSTEM_SUPERLU})
# avoid using again
option_defaults_clear()