summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Lyanguzov <timothy.lyanguzov@sap.com>2021-06-04 09:57:46 +1200
committerNick Wellnhofer <wellnhofer@aevum.de>2021-06-07 21:43:08 +0200
commit22f1521122402bee88b58a463af58b5ab865dc3f (patch)
tree0d40698aced9bb0a22f9db2c855c2263c6544c88
parent92d9ab4c28842a09ca2b76d3ff2f933e01b6cd6f (diff)
downloadlibxml2-22f1521122402bee88b58a463af58b5ab865dc3f.tar.gz
Use version in configure.ac for CMake
Now CMake script reads version from configure.ac to prevent unsynchronized versions
-rw-r--r--CMakeLists.txt17
1 files changed, 11 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b4c0c794..073869fc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,16 @@
cmake_minimum_required(VERSION 3.15)
-project(libxml2 VERSION 2.9.12 LANGUAGES C)
+file(STRINGS "configure.ac" CONFIGURE_AC_LINES)
+foreach(line ${CONFIGURE_AC_LINES})
+ if(line MATCHES [[^m4_define\(\[(MAJOR_VERSION|MINOR_VERSION|MICRO_VERSION)\],[ \t]*([0-9]+)\)$]])
+ set(LIBXML_${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
+ elseif(line MATCHES "^(LIBXML_MAJOR_VERSION|LIBXML_MINOR_VERSION|LIBXML_MICRO_VERSION)=([0-9]+)$")
+ set(${CMAKE_MATCH_1} ${CMAKE_MATCH_2})
+ endif()
+endforeach()
+set(VERSION "${LIBXML_MAJOR_VERSION}.${LIBXML_MINOR_VERSION}.${LIBXML_MICRO_VERSION}")
+
+project(libxml2 VERSION ${VERSION} LANGUAGES C)
include(CheckCSourceCompiles)
include(CheckFunctionExists)
@@ -95,11 +105,6 @@ foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_D
endif()
endforeach()
-set(LIBXML_MAJOR_VERSION ${PROJECT_VERSION_MAJOR})
-set(LIBXML_MINOR_VERSION ${PROJECT_VERSION_MINOR})
-set(LIBXML_MICRO_VERSION ${PROJECT_VERSION_PATCH})
-
-set(VERSION "${LIBXML_MAJOR_VERSION}.${LIBXML_MINOR_VERSION}.${LIBXML_MICRO_VERSION}")
set(LIBXML_VERSION ${LIBXML_MAJOR_VERSION}0${LIBXML_MINOR_VERSION}0${LIBXML_MICRO_VERSION})
set(LIBXML_VERSION_STRING "${LIBXML_VERSION}")
set(LIBXML_VERSION_EXTRA "")