1 # Copyright (C) 2015 CEA/DEN, EDF R&D
3 # This library is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU Lesser General Public
5 # License as published by the Free Software Foundation; either
6 # version 2.1 of the License, or (at your option) any later version.
8 # This library is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 # Lesser General Public License for more details.
13 # You should have received a copy of the GNU Lesser General Public
14 # License along with this library; if not, write to the Free Software
15 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ####################################################################
20 # Convert a number (smaller than 16) into hexadecimal representation
22 MACRO(_TOHEXA num result)
23 SET(_hexa_map a b c d e f)
25 SET(${result} "0${num}")
27 MATH(EXPR _res "${num}-10" )
28 LIST(GET _hexa_map ${_res} _out)
29 SET(${result} "0${_out}")
33 ####################################################################
36 # Computes hexadecimal version of MEDTOOL package
38 # USAGE: MEDTOOL_XVERSION(package)
42 # package: IN: MEDTOOL package name
44 # The macro reads MEDTOOL package version from PACKAGE_VERSION variable
45 # (note package name are uppercase);
46 # hexadecimal version value in form 0xAABBCC (where AA, BB and CC are
47 # major, minor and maintenance components of package version in
48 # hexadecimal form) is put to the PACKAGE_XVERSION variable
49 MACRO(MEDTOOL_XVERSION pkg)
50 STRING(TOUPPER ${pkg} _pkg_UC)
51 IF(${_pkg_UC}_VERSION)
55 _TOHEXA(${${_pkg_UC}_MAJOR_VERSION} _major)
56 _TOHEXA(${${_pkg_UC}_MINOR_VERSION} _minor)
57 _TOHEXA(${${_pkg_UC}_PATCH_VERSION} _patch)
58 SET(${_pkg_UC}_XVERSION "0x${_major}${_minor}${_patch}")
60 ENDMACRO(MEDTOOL_XVERSION)