@@ -62,40 +62,22 @@ set(NNG_DESCRIPTION "High-Performance Scalability Protocols NextGen")
62
62
set (ISSUE_REPORT_MSG "Please consider opening an issue at https://github.com/nanomsg/nng" )
63
63
64
64
# Determine library versions.
65
- set (NNG_ABI_SOVERSION 1)
66
- set (NNG_ABI_VERSION "1.3.0" )
67
-
68
- # Determine package version.
69
- find_package (Git QUIET )
70
- if (GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR} /.git" )
71
- # Working off a git repo, using git versioning
72
-
73
- # Get version from last tag
74
- execute_process (
75
- COMMAND "${GIT_EXECUTABLE} " describe --always# | sed -e "s:v::"
76
- WORKING_DIRECTORY "${PROJECT_SOURCE_DIR} "
77
- OUTPUT_VARIABLE NNG_PACKAGE_VERSION
78
- OUTPUT_STRIP_TRAILING_WHITESPACE)
79
-
80
- # If the sources have been changed locally, add -dirty to the version.
81
- execute_process (
82
- COMMAND "${GIT_EXECUTABLE} " diff --quiet
83
- WORKING_DIRECTORY "${PROJECT_SOURCE_DIR} "
84
- RESULT_VARIABLE res)
85
- if (res EQUAL 1)
86
- set (NNG_PACKAGE_VERSION "${NNG_PACKAGE_VERSION} -dirty" )
87
- endif ()
88
-
89
- else ()
90
- set (NNG_PACKAGE_VERSION "Unknown" )
91
- endif ()
92
- if ("${NNG_PACKAGE_VERSION} " MATCHES "v[0-9]" )
93
- string (SUBSTRING "${NNG_PACKAGE_VERSION} " 1 -1 NNG_PACKAGE_VERSION)
65
+ file (READ "include/nng/nng.h" nng_ver_h)
66
+ string (REGEX MATCH "NNG_MAJOR_VERSION ([0-9]*)" _ ${nng_ver_h} )
67
+ set (NNG_MAJOR_VERSION ${CMAKE_MATCH_1} )
68
+ string (REGEX MATCH "NNG_MINOR_VERSION ([0-9]*)" _ ${nng_ver_h} )
69
+ set (NNG_MINOR_VERSION ${CMAKE_MATCH_1} )
70
+ string (REGEX MATCH "NNG_PATCH_VERSION ([0-9]*)" _ ${nng_ver_h} )
71
+ set (NNG_PATCH_VERSION ${CMAKE_MATCH_1} )
72
+ string (REGEX MATCH "NNG_RELEASE_SUFFIX \" ([a-z0-9]*)\" " _ ${nng_ver_h} )
73
+ if (NOT (${CMAKE_MATCH_1} STREQUAL "" ))
74
+ set (NNG_PRERELEASE "-${CMAKE_MATCH_1} " )
94
75
endif ()
95
76
96
- string (REGEX REPLACE "([0-9]+).[0-9]+.+" "\\ 1" NNG_VERSION_MAJOR "${NNG_PACKAGE_VERSION} " )
97
- string (REGEX REPLACE "[0-9]+.([0-9]+).[0-9].+" "\\ 1" NNG_VERSION_MINOR "${NNG_PACKAGE_VERSION} " )
98
- string (REGEX REPLACE "[0-9]+.[0-9]+.([0-9]+).*" "\\ 1" NNG_VERSION_PATCH "${NNG_PACKAGE_VERSION} " )
77
+ set (NNG_ABI_SOVERSION 1)
78
+ set (NNG_ABI_VERSION "${NNG_MAJOR_VERSION} .${NNG_MINOR_VERSION} .${NNG_PATCH_VERSION}${NNG_PRERELEASE} " )
79
+ set (NNG_PACKAGE_VERSION "${NNG_ABI_VERSION} " )
80
+ message ("Configuring for NNG version ${NNG_ABI_VERSION} " )
99
81
100
82
# User-defined options.
101
83
0 commit comments