From: Tsuda Kageyu Date: Sun, 22 Nov 2015 01:38:35 +0000 (+0900) Subject: Merge branch 'genversion' of https://github.com/ufleisch/taglib into ufleisch-genversion X-Git-Tag: v1.11beta~107 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e9f70a59b20cc765db446bfab2849a15c7331ee2;p=taglib Merge branch 'genversion' of https://github.com/ufleisch/taglib into ufleisch-genversion # Conflicts: # CMakeLists.txt --- e9f70a59b20cc765db446bfab2849a15c7331ee2 diff --cc CMakeLists.txt index 88674bb9,bae9e2fc..2fe1dadb --- a/CMakeLists.txt +++ b/CMakeLists.txt @@@ -52,15 -52,22 +52,27 @@@ if(MSVC AND ENABLE_STATIC_RUNTIME endforeach(flag_var) endif() - set(TAGLIB_LIB_MAJOR_VERSION "1") - set(TAGLIB_LIB_MINOR_VERSION "10") - set(TAGLIB_LIB_PATCH_VERSION "0") + # Read version information from file taglib/toolkit/taglib.h into variables + # TAGLIB_LIB_MAJOR_VERSION, TAGLIB_LIB_MINOR_VERSION, TAGLIB_LIB_PATCH_VERSION. + foreach(version_part MAJOR MINOR PATCH) + set(version_var_name "TAGLIB_${version_part}_VERSION") + file(STRINGS taglib/toolkit/taglib.h version_line + REGEX "^#define +${version_var_name}") + if(NOT version_line) + message(FATAL_ERROR "${version_var_name} not found in taglib.h") + endif() + string(REGEX MATCH "${version_var_name} +([^ ]+)" result ${version_line}) + set(TAGLIB_LIB_${version_part}_VERSION ${CMAKE_MATCH_1}) + endforeach(version_part) ++ + # Only used to force cmake rerun when taglib.h changes. + configure_file(taglib/toolkit/taglib.h ${CMAKE_CURRENT_BINARY_DIR}/taglib.h.stamp) -set(TAGLIB_LIB_VERSION_STRING "${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}.${TAGLIB_LIB_PATCH_VERSION}") +if("${TAGLIB_LIB_PATCH_VERSION}" EQUAL "0") + set(TAGLIB_LIB_VERSION_STRING "${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}") +else() + set(TAGLIB_LIB_VERSION_STRING "${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}.${TAGLIB_LIB_PATCH_VERSION}") +endif() # 1. If the library source code has changed at all since the last update, then increment revision. # 2. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.