blob: db5c197df29c9ba53a6b086122221b29ae1355d4 [file] [log] [blame]
diff -urN pastix.orig/CMakeLists.txt pastix/CMakeLists.txt
--- pastix.orig/CMakeLists.txt 2021-04-19 20:21:34.300303200 +0200
+++ pastix/CMakeLists.txt 2021-04-19 20:22:51.998513000 +0200
@@ -138,7 +138,7 @@
option(PASTIX_ORDERING_SCOTCH
"Enable Scotch Ordering" ON)
option(PASTIX_ORDERING_METIS
- "Enable Metis ordering" OFF)
+ "Enable Metis ordering" OFF)
cmake_dependent_option(PASTIX_ORDERING_PTSCOTCH
"Activate the PT-scotch ordering (requires PASTIX_ORDERING_SCOTCH)" OFF
"PASTIX_WITH_MPI;PASTIX_ORDERING_SCOTCH" OFF)
@@ -348,7 +348,7 @@
endif()
if (PASTIX_ORDERING_SCOTCH)
- find_package(SCOTCH)
+ find_package(SCOTCH REQUIRED)
if (SCOTCH_FOUND)
cmake_dependent_option(PASTIX_ORDERING_SCOTCH_MT
@@ -368,7 +368,7 @@
# PaStiX might depend on Metis/ParMetis
#--------------------------------------
if (PASTIX_ORDERING_METIS)
- find_package(METIS)
+ find_package(METIS REQUIRED)
if (METIS_FOUND)
# Check coherency for integer size
diff -urN pastix.orig/cmake_modules/morse_cmake/modules/find/FindMETIS.cmake pastix/cmake_modules/morse_cmake/modules/find/FindMETIS.cmake
--- pastix.orig/cmake_modules/morse_cmake/modules/find/FindMETIS.cmake 2021-04-19 20:21:34.708067800 +0200
+++ pastix/cmake_modules/morse_cmake/modules/find/FindMETIS.cmake 2021-04-19 20:26:47.109556000 +0200
@@ -74,16 +74,14 @@
# check a function to validate the find
if(METIS_LIBRARIES)
- # check if static or dynamic lib
- morse_check_static_or_dynamic(METIS METIS_LIBRARIES)
- if(METIS_STATIC)
- set(STATIC "_STATIC")
- else()
- set(STATIC "")
+ # Metis may depend on the M library and the static compilation does
+ # not include the dependency, so we enforce it
+ find_package(M QUIET)
+ if ( M_FOUND )
+ set( METIS_LIBRARIES "${METIS_LIBRARIES};${M_LIBRARIES}" )
endif()
- # set required libraries for link
- morse_set_required_test_lib_link(METIS)
+ morse_cmake_required_set(METIS)
# test link
unset(METIS_WORKS CACHE)
@@ -100,9 +98,7 @@
message(STATUS "Check in CMakeFiles/CMakeError.log to figure out why it fails")
endif()
endif()
- set(CMAKE_REQUIRED_INCLUDES)
- set(CMAKE_REQUIRED_FLAGS)
- set(CMAKE_REQUIRED_LIBRARIES)
+ morse_cmake_required_unset()
list(GET METIS_LIBRARIES 0 first_lib)
get_filename_component(first_lib_path "${first_lib}" DIRECTORY)
@@ -120,13 +116,15 @@
endif(METIS_LIBRARIES)
-# Check the size of METIS_Idx
-# ---------------------------------
-set(CMAKE_REQUIRED_INCLUDES ${METIS_INCLUDE_DIRS})
-include(CheckCSourceRuns)
-#stdio.h and stdint.h should be included by metis.h directly
-set(METIS_C_TEST_METIS_Idx_4 "
+if (METIS_WORKS)
+ morse_cmake_required_set(METIS)
+
+ # Check the size of METIS_Idx
+ # ---------------------------------
+ include(CheckCSourceRuns)
+ #stdio.h and stdint.h should be included by metis.h directly
+ set(METIS_C_TEST_METIS_Idx_4 "
#include <stdio.h>
#include <stdint.h>
#include <metis.h>
@@ -138,7 +136,7 @@
}
")
-set(METIS_C_TEST_METIS_Idx_8 "
+ set(METIS_C_TEST_METIS_Idx_8 "
#include <stdio.h>
#include <stdint.h>
#include <metis.h>
@@ -149,20 +147,22 @@
return 1;
}
")
-unset(METIS_Idx_4 CACHE)
-unset(METIS_Idx_8 CACHE)
-check_c_source_runs("${METIS_C_TEST_METIS_Idx_4}" METIS_Idx_4)
-check_c_source_runs("${METIS_C_TEST_METIS_Idx_8}" METIS_Idx_8)
-if(NOT METIS_Idx_4)
- if(NOT METIS_Idx_8)
- set(METIS_INTSIZE -1)
+ unset(METIS_Idx_4 CACHE)
+ unset(METIS_Idx_8 CACHE)
+ check_c_source_runs("${METIS_C_TEST_METIS_Idx_4}" METIS_Idx_4)
+ check_c_source_runs("${METIS_C_TEST_METIS_Idx_8}" METIS_Idx_8)
+ if(NOT METIS_Idx_4)
+ if(NOT METIS_Idx_8)
+ set(METIS_INTSIZE -1)
+ else()
+ set(METIS_INTSIZE 8)
+ endif()
else()
- set(METIS_INTSIZE 8)
+ set(METIS_INTSIZE 4)
endif()
-else()
- set(METIS_INTSIZE 4)
+
+ morse_cmake_required_unset()
endif()
-set(CMAKE_REQUIRED_INCLUDES "")
# check that METIS has been found
# ---------------------------------