From a2463a6766c9a02d0ab99263906f74ac0f73091b Mon Sep 17 00:00:00 2001
From: Bartosz Kosiorek <bartosz.kosiorek@tomtom.com>
Date: Mon, 20 Jun 2016 14:34:09 +0200
Subject: [PATCH] Add description of versions target property for Mach-O file
 format

---
 Help/prop_tgt/FRAMEWORK.rst |  4 ++++
 Help/prop_tgt/NO_SONAME.rst |  8 ++++----
 Help/prop_tgt/SOVERSION.rst | 34 ++++++++++++++++++++++++++++------
 Help/prop_tgt/VERSION.rst   | 35 ++++++++++++++++++++++++++++-------
 4 files changed, 64 insertions(+), 17 deletions(-)

diff --git a/Help/prop_tgt/FRAMEWORK.rst b/Help/prop_tgt/FRAMEWORK.rst
index 6c212c3..8120c36 100644
--- a/Help/prop_tgt/FRAMEWORK.rst
+++ b/Help/prop_tgt/FRAMEWORK.rst
@@ -26,6 +26,10 @@ Example of creation ``dynamicFramework``:
     FRAMEWORK_VERSION C
     MACOSX_FRAMEWORK_IDENTIFIER com.cmake.dynamicFramework
     MACOSX_FRAMEWORK_INFO_PLIST Info.plist
+    # "current version" in semantic format in Mach-O binary file
+    VERSION 16.4.0
+    # "compatibility version" in semantic format in Mach-O binary file
+    SOVERSION 1.0.0
     PUBLIC_HEADER dynamicFramework.h
     XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "iPhone Developer"
   )
diff --git a/Help/prop_tgt/NO_SONAME.rst b/Help/prop_tgt/NO_SONAME.rst
index ee45ed8..f6351f6 100644
--- a/Help/prop_tgt/NO_SONAME.rst
+++ b/Help/prop_tgt/NO_SONAME.rst
@@ -1,13 +1,13 @@
 NO_SONAME
 ---------
 
-Whether to set "soname" when linking a shared library.
+Whether to set "soname" when linking a ``SHARED`` library.
 
-Enable this boolean property if a generated shared library
+Enable this boolean property if a generated ``SHARED`` library
 should not have "soname" set.  Default is to set "soname" on all
-shared libraries as long as the platform supports it.
+``SHARED`` libraries as long as the platform supports it.
 Generally, use this property only for leaf private libraries or
-plugins.  If you use it on normal shared libraries which other targets
+plugins.  If you use it on normal ``SHARED`` libraries which other targets
 link against, on some platforms a linker will insert a full path to
 the library (as specified at link time) into the dynamic section of
 the dependent binary.  Therefore, once installed, dynamic loader may
diff --git a/Help/prop_tgt/SOVERSION.rst b/Help/prop_tgt/SOVERSION.rst
index 672ff23..453ba1a 100644
--- a/Help/prop_tgt/SOVERSION.rst
+++ b/Help/prop_tgt/SOVERSION.rst
@@ -3,12 +3,34 @@ SOVERSION
 
 What version number is this target.
 
-For shared libraries VERSION and SOVERSION can be used to specify the
-build version and API version respectively.  When building or
+For shared libraries :prop_tgt:`VERSION` and ``SOVERSION`` can be used to
+specify the build version and API version respectively.  When building or
 installing appropriate symlinks are created if the platform supports
 symlinks and the linker supports so-names.  If only one of both is
 specified the missing is assumed to have the same version number.
-SOVERSION is ignored if NO_SONAME property is set.  For shared
-libraries and executables on Windows the VERSION attribute is parsed
-to extract a "major.minor" version number.  These numbers are used as
-the image version of the binary.
+``SOVERSION`` is ignored if :prop_tgt:`NO_SONAME` property is set.
+
+For shared libraries and executables on Windows the :prop_tgt:`VERSION`
+attribute is parsed to extract a "major.minor" version number.
+These numbers are used as the image version of the binary.
+
+For ``SHARED`` libraries and executables on Mach-O systems (eg. OS X, iOS),
+the ``SOVERSION`` property correspond to ```compatibility version``` and
+:prop_tgt:`VERSION` to ```current version```.  Versions of Mach-O binaries,
+could be checked with command ``otool -L <binary>``.
+
+
+Usage on ``VERSION`` and ``SOVERSION`` on Mach-O example:
+
+.. code-block:: cmake
+
+  add_library(dynamicFramework SHARED
+              dynamicFramework.c
+              dynamicFramework.h
+  )
+  set_target_properties(dynamicFramework PROPERTIES
+    VERSION # "current version" in semantic format in Mach-O binary file
+      16.4.0
+    SOVERSION # "compatibility version" in semantic format in Mach-O binary file
+      1
+  )
diff --git a/Help/prop_tgt/VERSION.rst b/Help/prop_tgt/VERSION.rst
index 87f6c49..14beb14 100644
--- a/Help/prop_tgt/VERSION.rst
+++ b/Help/prop_tgt/VERSION.rst
@@ -3,14 +3,35 @@ VERSION
 
 What version number is this target.
 
-For shared libraries VERSION and SOVERSION can be used to specify the
-build version and API version respectively.  When building or
+For shared libraries ``VERSION`` and :prop_tgt:`SOVERSION` can be used
+to specify the build version and API version respectively.  When building or
 installing appropriate symlinks are created if the platform supports
 symlinks and the linker supports so-names.  If only one of both is
 specified the missing is assumed to have the same version number.  For
-executables VERSION can be used to specify the build version.  When
+executables ``VERSION`` can be used to specify the build version.  When
 building or installing appropriate symlinks are created if the
-platform supports symlinks.  For shared libraries and executables on
-Windows the VERSION attribute is parsed to extract a "major.minor"
-version number.  These numbers are used as the image version of the
-binary.
+platform supports symlinks.
+
+For ``SHARED`` libraries and executables on Windows the ``VERSION``
+attribute is parsed to extract a "major.minor" version number.
+These numbers are used as the image version of the binary.
+
+For ``SHARED`` libraries and executables on Mach-O systems (eg. OS X, iOS),
+the :prop_tgt:`SOVERSION` property correspond to ```compatibility version```
+and `VERSION`` to ```current version```.  Versions of Mach-O binaries,
+could be checked with command ``otool -L <binary>``.
+
+Example of usage on Mach-O and :prop_tgt:`FRAMEWORK`:
+
+.. code-block:: cmake
+
+  add_library(dynamicFramework SHARED
+              dynamicFramework.c
+              dynamicFramework.h
+  )
+  set_target_properties(dynamicFramework PROPERTIES
+    VERSION # "current version" in semantic format in Mach-O binary file
+      16.4.0
+    SOVERSION # "compatibility version" in semantic format in Mach-O binary file
+      1.0.0
+  )
-- 
2.7.4 (Apple Git-66)

