]> granicus.if.org Git - taglib/commitdiff
Merge branch 'genversion' of https://github.com/ufleisch/taglib into ufleisch-genversion
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Sun, 22 Nov 2015 01:38:35 +0000 (10:38 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Sun, 22 Nov 2015 01:38:35 +0000 (10:38 +0900)
# Conflicts:
# CMakeLists.txt

1  2 
CMakeLists.txt

diff --cc CMakeLists.txt
index 88674bb98f7cbed193b438b2e24047245431b545,bae9e2fc5be9efe8338a0cf49e00eff483a97253..2fe1dadb6fa19cc4fbae53a25ec9c09da9c37bda
@@@ -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.