VersionFunctions.cmake 974 B

1234567891011121314151617181920
  1. function(get_library_version VERSION_ARG)
  2. file(STRINGS include/rabbitmq-c/amqp.h _API_VERSION_MAJOR REGEX "^#define AMQP_VERSION_MAJOR [0-9]+$")
  3. file(STRINGS include/rabbitmq-c/amqp.h _API_VERSION_MINOR REGEX "^#define AMQP_VERSION_MINOR [0-9]+$")
  4. file(STRINGS include/rabbitmq-c/amqp.h _API_VERSION_PATCH REGEX "^#define AMQP_VERSION_PATCH [0-9]+$")
  5. string(REGEX MATCH "[0-9]+" _API_VERSION_MAJOR ${_API_VERSION_MAJOR})
  6. string(REGEX MATCH "[0-9]+" _API_VERSION_MINOR ${_API_VERSION_MINOR})
  7. string(REGEX MATCH "[0-9]+" _API_VERSION_PATCH ${_API_VERSION_PATCH})
  8. # VERSION to match what is in autotools
  9. set(${VERSION_ARG} ${_API_VERSION_MAJOR}.${_API_VERSION_MINOR}.${_API_VERSION_PATCH} PARENT_SCOPE)
  10. endfunction()
  11. function(compute_soversion CURRENT REVISION AGE SOVERSION)
  12. math(EXPR MAJOR "${CURRENT} - ${AGE}")
  13. math(EXPR MINOR "${AGE}")
  14. math(EXPR PATCH "${REVISION}")
  15. set(${SOVERSION} ${MAJOR} PARENT_SCOPE)
  16. endfunction()