mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-02-03 21:50:28 +01:00
Keep cmake defines GLIB_VERSION_... in sync with autotools.
This patch adds autotools related cmake macros autoinit() and autodefine(). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=89284 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
This commit is contained in:
parent
38e64d7571
commit
dca6591fa2
3 changed files with 51 additions and 12 deletions
|
|
@ -15,7 +15,8 @@ endif(COMMAND cmake_policy)
|
|||
|
||||
# detect version
|
||||
include(MacrosAutotools)
|
||||
autoversion(../configure.ac dbus)
|
||||
autoinit(../configure.ac)
|
||||
autoversion(dbus)
|
||||
# used by file version info
|
||||
set (DBUS_PATCH_VERSION "0")
|
||||
|
||||
|
|
@ -183,6 +184,11 @@ if (UNIX AND NOT DBUS_DISABLE_ASSERT)
|
|||
add_definitions(-DDBUS_BUILT_R_DYNAMIC)
|
||||
endif (UNIX AND NOT DBUS_DISABLE_ASSERT)
|
||||
|
||||
if(DBUS_WITH_GLIB)
|
||||
autodefine(GLIB_VERSION_MIN_REQUIRED)
|
||||
autodefine(GLIB_VERSION_MAX_ALLOWED)
|
||||
endif()
|
||||
|
||||
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
|
||||
|
||||
#########################################################################
|
||||
|
|
|
|||
|
|
@ -96,6 +96,10 @@
|
|||
|
||||
#cmakedefine DBUS_VA_COPY_AS_ARRAY @DBUS_VA_COPY_AS_ARRAY@
|
||||
|
||||
#cmakedefine DBUS_WITH_GLIB 1
|
||||
#cmakedefine GLIB_VERSION_MIN_REQUIRED @GLIB_VERSION_MIN_REQUIRED@
|
||||
#cmakedefine GLIB_VERSION_MAX_ALLOWED @GLIB_VERSION_MAX_ALLOWED@
|
||||
|
||||
// headers
|
||||
/* Define to 1 if you have dirent.h */
|
||||
#cmakedefine HAVE_DIRENT_H 1
|
||||
|
|
|
|||
|
|
@ -1,6 +1,21 @@
|
|||
#
|
||||
# cmake package for autotools support
|
||||
#
|
||||
# @Author Ralf Habacker
|
||||
#
|
||||
|
||||
#
|
||||
# load autotools configure file into an internal list named _configure_ac
|
||||
#
|
||||
macro(autoinit config)
|
||||
set(_configure_ac_name ${config})
|
||||
file(READ ${config} _configure_ac_raw)
|
||||
# Convert file contents into a CMake list (where each element in the list
|
||||
# is one line of the file)
|
||||
STRING(REGEX REPLACE ";" "\\\\;" _configure_ac "${_configure_ac_raw}")
|
||||
STRING(REGEX REPLACE "\n" ";" _configure_ac "${_configure_ac}")
|
||||
endmacro()
|
||||
|
||||
# extracts version information from autoconf config file
|
||||
# and set related cmake variables
|
||||
#
|
||||
|
|
@ -14,17 +29,16 @@
|
|||
# ${prefix}_LIBRARY_REVISION
|
||||
# ${prefix}_LIBRARY_CURRENT
|
||||
#
|
||||
macro(autoversion config prefix)
|
||||
file (READ ${config} _configure_ac)
|
||||
string(TOUPPER ${prefix} prefix_upper)
|
||||
string (REGEX REPLACE ".*${prefix}_major_version], .([0-9]+).*" "\\1" ${prefix_upper}_MAJOR_VERSION ${_configure_ac})
|
||||
string (REGEX REPLACE ".*${prefix}_minor_version], .([0-9]+).*" "\\1" ${prefix_upper}_MINOR_VERSION ${_configure_ac})
|
||||
string (REGEX REPLACE ".*${prefix}_micro_version], .([0-9]+).*" "\\1" ${prefix_upper}_MICRO_VERSION ${_configure_ac})
|
||||
set (${prefix_upper}_VERSION ${${prefix_upper}_MAJOR_VERSION}.${${prefix_upper}_MINOR_VERSION}.${${prefix_upper}_MICRO_VERSION})
|
||||
set (${prefix_upper}_VERSION_STRING "${${prefix_upper}_VERSION}")
|
||||
string (REGEX REPLACE ".*LT_AGE=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_AGE ${_configure_ac})
|
||||
string (REGEX REPLACE ".*LT_CURRENT=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_CURRENT ${_configure_ac})
|
||||
string (REGEX REPLACE ".*LT_REVISION=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_REVISION ${_configure_ac})
|
||||
macro(autoversion prefix)
|
||||
string(TOUPPER ${prefix} prefix_upper)
|
||||
string (REGEX REPLACE ".*${prefix}_major_version], .([0-9]+).*" "\\1" ${prefix_upper}_MAJOR_VERSION ${_configure_ac_raw})
|
||||
string (REGEX REPLACE ".*${prefix}_minor_version], .([0-9]+).*" "\\1" ${prefix_upper}_MINOR_VERSION ${_configure_ac_raw})
|
||||
string (REGEX REPLACE ".*${prefix}_micro_version], .([0-9]+).*" "\\1" ${prefix_upper}_MICRO_VERSION ${_configure_ac_raw})
|
||||
set (${prefix_upper}_VERSION ${${prefix_upper}_MAJOR_VERSION}.${${prefix_upper}_MINOR_VERSION}.${${prefix_upper}_MICRO_VERSION})
|
||||
set (${prefix_upper}_VERSION_STRING "${${prefix_upper}_VERSION}")
|
||||
string (REGEX REPLACE ".*LT_AGE=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_AGE ${_configure_ac_raw})
|
||||
string (REGEX REPLACE ".*LT_CURRENT=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_CURRENT ${_configure_ac_raw})
|
||||
string (REGEX REPLACE ".*LT_REVISION=([0-9]+).*" "\\1" ${prefix_upper}_LIBRARY_REVISION ${_configure_ac_raw})
|
||||
endmacro()
|
||||
|
||||
#
|
||||
|
|
@ -87,6 +101,21 @@ macro(autopackage name version url support_url)
|
|||
")
|
||||
endmacro(autopackage)
|
||||
|
||||
#
|
||||
# define a cmake variable from autotools AC_DEFINE statement
|
||||
#
|
||||
macro(autodefine name)
|
||||
foreach(line ${_configure_ac})
|
||||
if(line MATCHES ".*AC_DEFINE(.*${name}.*).*")
|
||||
string (REGEX REPLACE ".*AC_DEFINE(.*).*" "\\1" value ${line})
|
||||
string (REGEX REPLACE ".*,(.*),.*" "\\1" value2 ${value})
|
||||
string (REPLACE "[" "" value3 ${value2})
|
||||
string (REPLACE "]" "" value4 ${value3})
|
||||
set(${name} ${value4})
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
|
||||
#
|
||||
# parses config.h template and create cmake equivalent
|
||||
# not implemented yet
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue