Skip to content
Snippets Groups Projects
Commit 8a4aa6a4 authored by Markus Blatt's avatar Markus Blatt
Browse files

Merge branch 'feature/stop-finding-old-superlu' into 'master'

Stop finding old SuperLU versions.

Previously CMake pretended to have found a valid
SuperLU version for DUNE even if the version was
too old (i.e. < 4). People having such an old versions
only noticed this via later compile errors of binaries
using SuperLU. That is far too late.

With this patch we introduce a compile check into the
CMake module that fails for old unsupported versions.
In that case CMake will not find SuperLU.

See merge request !52
parents 49e78fa1 cffd9578
No related branches found
No related tags found
No related merge requests found
# .. cmake_module::
#
# Module that checks whether SuperLU is available and usable.
# SuperLU must be a version released after the year 2005.
# SuperLU must be 4.0 or newer.
#
# Variables used by this module which you may want to set:
#
......@@ -13,9 +13,15 @@
# :code:`SUPERLU_FOUND`
# True if SuperLU available and usable.
#
# :code:`SUPERLU_MIN_VERSION_4`
# True if SuperLU version >= 4.0.
#
# :code:`SUPERLU_MIN_VERSION_4_3`
# True if SuperLU version >= 4.3.
#
# :code:`SUPERLU_MIN_VERSION_5`
# True if SuperLU version >= 5.0.
#
# :code:`SUPERLU_WITH_VERSION`
# Human readable string containing version information.
#
......@@ -86,8 +92,20 @@ endif(SUPERLU_LIBRARY)
if(BLAS_LIBRARIES)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${BLAS_LIBRARIES})
endif(BLAS_LIBRARIES)
# check wether version is new enough >= 4.0
check_c_source_compiles("
typedef int int_t;
#include <supermatrix.h>
#include <slu_util.h>
int main()
{
SuperLUStat_t stat;
stat.expansions=8;
return 0;
}" SUPERLU_MIN_VERSION_4)
# check whether version is at least 4.3
CHECK_C_SOURCE_COMPILES("
check_c_source_compiles("
#include <slu_ddefs.h>
int main(void)
{
......@@ -95,7 +113,8 @@ int main(void)
}"
SUPERLU_MIN_VERSION_4_3)
CHECK_C_SOURCE_COMPILES("
# check whether version is at least 5.0
check_c_source_compiles("
typedef int int_t;
#include <supermatrix.h>
#include <slu_util.h>
......@@ -108,15 +127,20 @@ SUPERLU_MIN_VERSION_5)
cmake_pop_check_state()
if(SUPERLU_MIN_VERSION_5)
set(SUPERLU_WITH_VERSION "SuperLU >= 5.0" CACHE STRING
"Human readable string containing SuperLU version information.")
elseif(SUPERLU_MIN_VERSION_4_3)
set(SUPERLU_WITH_VERSION "SuperLU >= 4.3" CACHE STRING
if(NOT SUPERLU_MIN_VERSION_4)
set(SUPERLU_WITH_VERSION "SuperLU < 4.0" CACHE STRING
"Human readable string containing SuperLU version information.")
else()
set(SUPERLU_WITH_VERSION "SuperLU <= 4.2 and >= 4.0" CACHE STRING
"Human readable string containing SuperLU version information.")
if(SUPERLU_MIN_VERSION_5)
set(SUPERLU_WITH_VERSION "SuperLU >= 5.0" CACHE STRING
"Human readable string containing SuperLU version information.")
elseif(SUPERLU_MIN_VERSION_4_3)
set(SUPERLU_WITH_VERSION "SuperLU >= 4.3" CACHE STRING
"Human readable string containing SuperLU version information.")
else()
set(SUPERLU_WITH_VERSION "SuperLU <= 4.2 and >= 4.0" CACHE STRING
"Human readable string containing SuperLU version information.")
endif()
endif()
# behave like a CMake module is supposed to behave
......@@ -127,10 +151,13 @@ find_package_handle_standard_args(
BLAS_FOUND
SUPERLU_INCLUDE_DIR
SUPERLU_LIBRARY
SUPERLU_MIN_VERSION_4
)
mark_as_advanced(SUPERLU_INCLUDE_DIR SUPERLU_LIBRARY)
set_package_info("SuperLU" "Direct linear solver library")
# if both headers and library are found, store results
if(SUPERLU_FOUND)
set(SUPERLU_INCLUDE_DIRS ${SUPERLU_INCLUDE_DIR})
......@@ -149,7 +176,8 @@ else(SUPERLU_FOUND)
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
"Determining location of SuperLU failed:\n"
"Include directory: ${SUPERLU_INCLUDE_DIRS}\n"
"Library directory: ${SUPERLU_LIBRARIES}\n\n")
"Library directory: ${SUPERLU_LIBRARIES}\n"
"Found unsupported version: ${SUPERLU_WITH_VERSION}\n\n")
endif(SUPERLU_FOUND)
# set HAVE_SUPERLU for config.h
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment