From 502b61b52ebe24c934c748eb7be10efbecaa68ab Mon Sep 17 00:00:00 2001
From: Chuck Atkins <chuck.atkins@kitware.com>
Date: Fri, 23 Jun 2017 15:42:37 -0400
Subject: [PATCH] Setup library versioning.

Fixes #152
---
 source/adios2/CMakeLists.txt  | 6 ++++++
 source/dataman/CMakeLists.txt | 8 +++++++-
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/source/adios2/CMakeLists.txt b/source/adios2/CMakeLists.txt
index ce26aa233..3787518f9 100644
--- a/source/adios2/CMakeLists.txt
+++ b/source/adios2/CMakeLists.txt
@@ -133,6 +133,12 @@ if(ADIOS2_HAVE_HDF5)
   target_link_libraries(adios2 PRIVATE ${HDF5_C_LIBRARIES})
 endif()
 
+# Set library version information
+set_target_properties(adios2 PROPERTIES
+  VERSION ${ADIOS2_VERSION}
+  SOVERSION ${ADIOS2_VERSION_MAJOR}
+)
+
 install(
   FILES ADIOSMacros.h ADIOSTypes.h ADIOSMPICommOnly.h
   DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/adios2
diff --git a/source/dataman/CMakeLists.txt b/source/dataman/CMakeLists.txt
index 4387f9569..9dcfdef1a 100644
--- a/source/dataman/CMakeLists.txt
+++ b/source/dataman/CMakeLists.txt
@@ -54,7 +54,6 @@ if(ADIOS2_HAVE_ZeroMQ)
   list(APPEND dataman_targets mdtmman)
 endif()
 
-
 if(ADIOS2_HAVE_ZFP)
   find_package(ZFP REQUIRED)
 
@@ -64,6 +63,13 @@ if(ADIOS2_HAVE_ZFP)
   list(APPEND dataman_targets zfpman)
 endif()
 
+# Library versioning like this only makes sense for libdataman.  The others are plugins
+# loaded via dlopen.
+set_target_properties(dataman PROPERTIES
+  VERSION ${ADIOS2_VERSION}
+  SOVERSION ${ADIOS2_VERSION_MAJOR}
+)
+
 install(
   TARGETS ${dataman_targets} EXPORT adios2
   RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-- 
GitLab