From 1ac52e06b823644510911239b790fb09ec94b2e5 Mon Sep 17 00:00:00 2001
From: Markus Blatt <markus@dr-blatt.de>
Date: Tue, 25 Aug 2015 17:53:47 +0200
Subject: [PATCH] [cmake,release] Also use libscotch when linking with
 PTScotch.

Without it linking will fail when using static libraries due
to missing symbols.
---
 cmake/modules/AddPTScotchFlags.cmake | 2 +-
 cmake/modules/FindPTScotch.cmake     | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/cmake/modules/AddPTScotchFlags.cmake b/cmake/modules/AddPTScotchFlags.cmake
index 6d9a8655e..f1ae6fabe 100644
--- a/cmake/modules/AddPTScotchFlags.cmake
+++ b/cmake/modules/AddPTScotchFlags.cmake
@@ -9,7 +9,7 @@
 function(add_dune_ptscotch_flags _targets)
   if(PTSCOTCH_FOUND)
     foreach(_target ${_targets})
-      target_link_libraries(${_target} ${PTSCOTCH_LIBRARY} ${PTSCOTCHERR_LIBRARY})
+      target_link_libraries(${_target} ${PTSCOTCH_LIBRARY} ${SCOTCH_LIBRARY}  ${PTSCOTCHERR_LIBRARY})
       GET_TARGET_PROPERTY(_props ${_target} INCLUDE_DIRECTORIES)
       string(REPLACE "_props-NOTFOUND" "" _props "${_props}")
       SET_TARGET_PROPERTIES(${_target} PROPERTIES INCLUDE_DIRECTORIES
diff --git a/cmake/modules/FindPTScotch.cmake b/cmake/modules/FindPTScotch.cmake
index 9b2cfb448..a99b6580e 100644
--- a/cmake/modules/FindPTScotch.cmake
+++ b/cmake/modules/FindPTScotch.cmake
@@ -47,6 +47,7 @@ find_path(PTSCOTCH_INCLUDE_DIR ptscotch.h
   PATH_SUFFIXES ${PATH_SUFFIXES})
 
 _search_pt_lib(PTSCOTCH_LIBRARY ptscotch "The main PT-Scotch library.")
+_search_pt_lib(SCOTCH_LIBRARY scotch "The Scotch library.")
 _search_pt_lib(PTSCOTCHERR_LIBRARY ptscotcherr "The PT-Scotch error library.")
 
 # behave like a CMake module is supposed to behave
@@ -56,6 +57,7 @@ find_package_handle_standard_args(
   DEFAULT_MSG
   PTSCOTCH_INCLUDE_DIR
   PTSCOTCH_LIBRARY
+  SCOTCH_LIBRARY
   PTSCOTCHERR_LIBRARY
 )
 #restore old values
@@ -63,7 +65,7 @@ cmake_pop_check_state()
 
 if(PTSCOTCH_FOUND)
   set(PTSCOTCH_INCLUDE_DIRS ${PTSCOTCH_INCLUDE_DIR})
-  set(PTSCOTCH_LIBRARIES ${PTSCOTCH_LIBRARY} ${PTSCOTCHERR_LIBRARY} ${MPI_DUNE_LIBRARIES}
+  set(PTSCOTCH_LIBRARIES ${PTSCOTCH_LIBRARY} ${SCOTCH_LIBRARY} ${PTSCOTCHERR_LIBRARY} ${MPI_DUNE_LIBRARIES}
     CACHE FILEPATH "All libraries needed to link programs using PT-Scotch")
   set(PTSCOCH_LINK_FLAGS "${DUNE_MPI_LINK_FLAGS}"
     CACHE STRING "PT-Scotch link flags")
-- 
GitLab