mirror of
https://gitlab.gnome.org/GNOME/libxml2
synced 2025-03-28 21:33:13 +00:00
Use version in configure.ac for CMake
Now CMake script reads version from configure.ac to prevent unsynchronized versions
This commit is contained in:
parent
92d9ab4c28
commit
22f1521122
@ -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 "")
|
||||
|
Loading…
x
Reference in New Issue
Block a user