aboutsummaryrefslogtreecommitdiff
path: root/modules/ECMSetVersionVariables.cmake
diff options
context:
space:
mode:
authorAlex Neundorf <neundorf@kde.org>2011-12-11 13:53:53 +0100
committerAlex Neundorf <neundorf@kde.org>2011-12-11 13:53:53 +0100
commitccc9151fb4dd859226fd34936af18e70d8c31d93 (patch)
treecdce6d961a604f33fcd91f0e92c6a822262705ba /modules/ECMSetVersionVariables.cmake
parent69c0c16af749650d58e4f7b2cd24d672147b533b (diff)
downloadextra-cmake-modules-ccc9151fb4dd859226fd34936af18e70d8c31d93.tar.gz
extra-cmake-modules-ccc9151fb4dd859226fd34936af18e70d8c31d93.tar.bz2
-add ECMSetVersionVariables.cmake, to replace ECMVersion.cmake: proper name, has documentation, requires a prefix
Alex
Diffstat (limited to 'modules/ECMSetVersionVariables.cmake')
-rw-r--r--modules/ECMSetVersionVariables.cmake41
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/ECMSetVersionVariables.cmake b/modules/ECMSetVersionVariables.cmake
new file mode 100644
index 00000000..db7f7888
--- /dev/null
+++ b/modules/ECMSetVersionVariables.cmake
@@ -0,0 +1,41 @@
+# - Convenience macro for setting version variables.
+# ECM_SET_VERSION_VARIABLES(<prefix> <major> <minor> <patch>)
+#
+# This macro sets the following variables:
+# <prefix>_VERSION_MAJOR to <major>
+# <prefix>_VERSION_MINOR to <minor>
+# <prefix>_VERSION_PATCH to <patch>
+# <prefix>_SOVERSION to <major>
+# <prefix>_VERSION_STRING to "<major>.<minor>.<patch>"
+#
+# It is basically a shortcut, so instead of
+#
+# set(FOO_MAJOR_VERSION 0)
+# set(FOO_MINOR_VERSION 0)
+# set(FOO_PATCH_VERSION 1)
+# set(FOO_SOVERSION ${FOO_SOVERSION} )
+# set(FOO_VERSION ${FOO_MAJOR_VERSION}.${FOO_MINOR_VERSION}.${FOO_PATCH_VERSION})
+#
+# you can simply write
+#
+# ecm_set_version_variables(FOO 0 0 1)
+#
+# You can do with these variables whatever you want, there is no other automagic or
+# anything that depends on them.
+
+# Copyright 2011 Alexander Neundorf <neundorf@kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+
+macro(ecm_set_version_variables _prefix _major _minor _patch)
+ set(${_prefix}_VERSION_MAJOR ${_major})
+ set(${_prefix}_VERSION_MINOR ${_minor})
+ set(${_prefix}_VERSION_PATCH ${_patch})
+ set(${_prefix}_SOVERSION ${_major})
+ set(${_prefix}_VERSION_STRING "${${_prefix}_VERSION_MAJOR}.${${_prefix}_VERSION_MINOR}.${${_prefix}_VERSION_PATCH}")
+endmacro()