SgVersion.cmake 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #.rst:
  2. # SgVersion
  3. # ---------
  4. #
  5. # Versioning variables.
  6. #
  7. # Variables containing the Sagui library version.
  8. #
  9. # ::
  10. #
  11. # SG_VERSION_MAJOR - Major version.
  12. # SG_VERSION_MINOR - Minor version.
  13. # SG_VERSION_PATCH - Patch version.
  14. # SOVERSION - Composed by "SG_VERSION_MAJOR".
  15. # VERSION - Composed by "SG_VERSION_MAJOR.SG_VERSION_MINOR.SG_VERSION_PATCH".
  16. # VERSION_SUFFIX - Composed by "-SG_VERSION_MAJOR" (Windows only).
  17. # _
  18. # ___ __ _ __ _ _ _(_)
  19. # / __|/ _` |/ _` | | | | |
  20. # \__ \ (_| | (_| | |_| | |
  21. # |___/\__,_|\__, |\__,_|_|
  22. # |___/
  23. #
  24. # Cross-platform library which helps to develop web servers or frameworks.
  25. #
  26. # Copyright (C) 2016-2019 Silvio Clecio <[email protected]>
  27. #
  28. # Sagui library is free software; you can redistribute it and/or
  29. # modify it under the terms of the GNU Lesser General Public
  30. # License as published by the Free Software Foundation; either
  31. # version 2.1 of the License, or (at your option) any later version.
  32. #
  33. # Sagui library is distributed in the hope that it will be useful,
  34. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  35. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  36. # Lesser General Public License for more details.
  37. #
  38. # You should have received a copy of the GNU Lesser General Public
  39. # License along with Sagui library; if not, write to the Free Software
  40. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  41. #
  42. if(__SG_VERSION_INCLUDED)
  43. return()
  44. endif()
  45. set(__SG_VERSION_INCLUDED ON)
  46. if(EXISTS ${SG_INCLUDE_DIR}/sagui.h)
  47. set(_version_list MAJOR MINOR PATCH)
  48. foreach(v ${_version_list})
  49. set(_regex_version "^#define SG_VERSION_${v} ([0-9])")
  50. file(STRINGS "${SG_INCLUDE_DIR}/sagui.h" SG_VERSION_${v}
  51. REGEX "${_regex_version}")
  52. string(REGEX REPLACE "${_regex_version}" "\\1" SG_VERSION_${v}
  53. "${SG_VERSION_${v}}")
  54. unset(_regex_version)
  55. endforeach()
  56. set(SOVERSION ${SG_VERSION_MAJOR})
  57. set(VERSION ${SG_VERSION_MAJOR}.${SG_VERSION_MINOR}.${SG_VERSION_PATCH})
  58. if(WIN32)
  59. set(VERSION_SUFFIX -${SG_VERSION_MAJOR})
  60. endif()
  61. unset(_version_list)
  62. endif()