From 19e081a35b257d5bdb5c9c298bef638a6b837186 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Mon, 3 Jul 2017 11:40:01 +0200
Subject: [PATCH] Modify the integer size detection in oredring to update the
 size at each configuration

---
 modules/find/FindMETIS.cmake    | 4 +++-
 modules/find/FindPTSCOTCH.cmake | 5 ++++-
 modules/find/FindSCOTCH.cmake   | 7 +++++--
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/modules/find/FindMETIS.cmake b/modules/find/FindMETIS.cmake
index 537f31a..ea67563 100644
--- a/modules/find/FindMETIS.cmake
+++ b/modules/find/FindMETIS.cmake
@@ -283,9 +283,11 @@ int main(int argc, char **argv) {
     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)
-  check_c_source_runs("${METIS_C_TEST_METIS_Idx_8}" METIS_Idx_8)
   if(NOT METIS_Idx_8)
     set(METIS_INTSIZE -1)
   else()
diff --git a/modules/find/FindPTSCOTCH.cmake b/modules/find/FindPTSCOTCH.cmake
index 56382f7..341358c 100644
--- a/modules/find/FindPTSCOTCH.cmake
+++ b/modules/find/FindPTSCOTCH.cmake
@@ -401,9 +401,12 @@ int main(int argc, char **argv) {
     return 1;
 }
 ")
+
+unset(PTSCOTCH_Num_4 CACHE)
+unset(PTSCOTCH_Num_8 CACHE)
 check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_4}" PTSCOTCH_Num_4)
+check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_8}" PTSCOTCH_Num_8)
 if(NOT PTSCOTCH_Num_4)
-  check_c_source_runs("${PTSCOTCH_C_TEST_SCOTCH_Num_8}" PTSCOTCH_Num_8)
   if(NOT PTSCOTCH_Num_8)
     set(PTSCOTCH_INTSIZE -1)
   else()
diff --git a/modules/find/FindSCOTCH.cmake b/modules/find/FindSCOTCH.cmake
index 89d295a..48f6542 100644
--- a/modules/find/FindSCOTCH.cmake
+++ b/modules/find/FindSCOTCH.cmake
@@ -309,7 +309,7 @@ if (SCOTCH_LIBRARIES)
   if (${first_lib_path} MATCHES "/lib(32|64)?$")
     string(REGEX REPLACE "/lib(32|64)?$" "" not_cached_dir "${first_lib_path}")
     set(SCOTCH_DIR_FOUND "${not_cached_dir}" CACHE PATH "Installation directory of SCOTCH library" FORCE)
-  else()
+   else()
     set(SCOTCH_DIR_FOUND "${first_lib_path}" CACHE PATH "Installation directory of SCOTCH library" FORCE)
   endif()
 endif()
@@ -345,9 +345,12 @@ int main(int argc, char **argv) {
     return 1;
 }
 ")
+
+unset(SCOTCH_Num_4 CACHE)
+unset(SCOTCH_Num_8 CACHE)
 check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_4}" SCOTCH_Num_4)
+check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_8}" SCOTCH_Num_8)
 if(NOT SCOTCH_Num_4)
-  check_c_source_runs("${SCOTCH_C_TEST_SCOTCH_Num_8}" SCOTCH_Num_8)
   if(NOT SCOTCH_Num_8)
     set(SCOTCH_INTSIZE -1)
   else()
-- 
GitLab