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

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.
parent 49e78fa1
Branches
Tags
1 merge request!52Stop finding old SuperLU versions.
Pipeline #
......@@ -86,6 +86,18 @@ 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("
#include <slu_ddefs.h>
......@@ -108,15 +120,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,6 +144,7 @@ find_package_handle_standard_args(
BLAS_FOUND
SUPERLU_INCLUDE_DIR
SUPERLU_LIBRARY
SUPERLU_MIN_VERSION_4
)
mark_as_advanced(SUPERLU_INCLUDE_DIR SUPERLU_LIBRARY)
......@@ -149,7 +167,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.
Please register or to comment