File Fix-library-version-numbering.patch of Package hypre

From: Egbert Eich <eich@suse.com>
Date: Fri Nov 29 13:14:06 2019 +0100
Subject: Fix library version numbering
Patch-mainline: Not yet
Git-commit: 1e62280e0eaa52761e04425d44da81865556baa7
References: 

Signed-off-by: Egbert Eich <eich@suse.com>
---
 hypre-2.18.2/src/CMakeLists.txt | 29 +++++++++++++++++------------
 1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/hypre-2.18.2/src/CMakeLists.txt b/hypre-2.18.2/src/CMakeLists.txt
index 8c09795..2b425f5 100644
--- a/hypre-2.18.2/src/CMakeLists.txt
+++ b/hypre-2.18.2/src/CMakeLists.txt
@@ -238,16 +238,6 @@ else ()
   set (BUILD_SHARED_LIBS OFF CACHE INTERNAL "" FORCE)
 endif ()
 
-# Set MPI compile flags
-if (NOT HYPRE_SEQUENTIAL)
-  find_package (MPI)
-  if ((MPI_C_FOUND) AND (NOT CMAKE_C_COMPILER STREQUAL MPI_C_COMPILER))
-    include_directories (${MPI_C_INCLUDE_PATH})
-    set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MPI_C_COMPILE_FLAGS}")
-    list(APPEND TPL_LIBRARIES ${MPI_C_LIBRARIES})
-  endif ()
-endif (NOT HYPRE_SEQUENTIAL)
-
 # Set OpenMP compile flags
 if (HYPRE_USING_OPENMP)
   find_package (OpenMP)
@@ -300,6 +290,21 @@ add_library (HYPRE ${HYPRE_SOURCES} ${HYPRE_HEADERS} ${FEI_LIBS})
 
 target_link_libraries(HYPRE PUBLIC ${TPL_LIBRARIES})
 
-install (TARGETS HYPRE DESTINATION lib)
-install (FILES ${HYPRE_HEADERS} DESTINATION include)
+# Here HYPRE_MINOR == HYPRE_MAJOR == HYPRE_VERSION
+set_target_properties(HYPRE PROPERTIES VERSION ${HYPRE_VERSION} SOVERSION ${HYPRE_VERSION})
+
+# Set MPI compile flags
+if (NOT HYPRE_SEQUENTIAL)
+  find_package (MPI)
+  include_directories (${MPI_C_INCLUDE_PATH})
+  if (MPI_COMPILE_FLAGS)
+    set_target_properties(HYPRE PROPERTIES COMPILE_FLAGS "${MPI_COMPILE_FLAGS}")
+  endif()
+  if (MPI_LINK_FLAGS)
+    set_target_properties(HYPRE PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
+  endif()
+  list(APPEND TPL_LIBRARIES ${MPI_C_LIBRARIES})
+endif (NOT HYPRE_SEQUENTIAL)
 
+install (TARGETS HYPRE DESTINATION lib${LIB_SUFFIX})
+install (FILES ${HYPRE_HEADERS} DESTINATION include/hypre)
openSUSE Build Service is sponsored by