summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmake/CMakeLists.txt8
-rw-r--r--cmake/config.h.cmake7
-rw-r--r--cmake/modules/MacrosAutotools.cmake60
3 files changed, 74 insertions, 1 deletions
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
index aecc74cd..bde43f03 100644
--- a/cmake/CMakeLists.txt
+++ b/cmake/CMakeLists.txt
@@ -19,6 +19,14 @@ autoversion(../configure.ac dbus)
# used by file version info
set (DBUS_PATCH_VERSION "0")
+# set PACKAGE_... variables
+autopackage(
+ dbus
+ ${DBUS_VERSION_STRING}
+ "http://dbus.freedesktop.org"
+ "https://bugs.freedesktop.org/enter_bug.cgi?product=dbus"
+)
+
include(Macros)
TIMESTAMP(DBUS_BUILD_TIMESTAMP)
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
index 824b5144..f14b169e 100644
--- a/cmake/config.h.cmake
+++ b/cmake/config.h.cmake
@@ -6,6 +6,12 @@
/* indicate that we are building with cmake */
#define DBUS_CMAKE 1
+@AUTOPACKAGE_CONFIG_H_TEMPLATE@
+
+/*
+ * Variables defined by AC_DEFINE in ../configure.ac
+ * should be placed in this file
+*/
#cmakedefine HAVE_GNUC_VARARGS 1
#cmakedefine DBUS_CONSOLE_AUTH_DIR "@DBUS_CONSOLE_AUTH_DIR@"
@@ -18,7 +24,6 @@
#cmakedefine DBUS_SESSION_BUS_CONNECT_ADDRESS "@DBUS_SESSION_BUS_CONNECT_ADDRESS@"
#cmakedefine DBUS_MACHINE_UUID_FILE "@DBUS_MACHINE_UUID_FILE@"
#cmakedefine DBUS_DAEMONDIR "@DBUS_DAEMONDIR@"
-#cmakedefine PACKAGE "@PACKAGE@"
#cmakedefine DBUS_ENABLE_STATS
diff --git a/cmake/modules/MacrosAutotools.cmake b/cmake/modules/MacrosAutotools.cmake
index ff30eaf9..68e8ae51 100644
--- a/cmake/modules/MacrosAutotools.cmake
+++ b/cmake/modules/MacrosAutotools.cmake
@@ -23,6 +23,66 @@ macro(autoversion config prefix)
endmacro()
#
+# Defines package related variables (PACKAGE_..., PACKAGE and VERSION)
+# as done by autotools.
+#
+# Additional it defines a cmake variable named PACKAGE_CONFIG_H_TEMPLATE
+# which could be placed in config.h templates to have those variables
+# defined at code level like shown below:
+#
+# config.h.template
+# ...
+# @AUTOPACKAGE_CONFIG_H_TEMPLATE@
+# ...
+#
+macro(autopackage name version url support_url)
+ # Define to the full name of this package.
+ set(PACKAGE_NAME ${name})
+
+ # Define to the version of this package.
+ set(PACKAGE_VERSION ${version})
+
+ # Define to the home page for this package.
+ set(PACKAGE_URL ${url})
+
+ # Define to the address where bug reports for this package should be sent.
+ set(PACKAGE_BUGREPORT ${support_url})
+
+ # Define to the full name and version of this package.
+ set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
+
+ # Define to the one symbol short name of this package.
+ set(PACKAGE_TARNAME ${PACKAGE_NAME})
+
+ set(PACKAGE ${name})
+ set(VERSION ${DBUS_VERSION_STRING})
+
+ set(AUTOPACKAGE_CONFIG_H_TEMPLATE "/* generated by cmake macro autopackage */\n
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT \"@PACKAGE_BUGREPORT@\"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME \"@PACKAGE_NAME@\"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING \"@PACKAGE_STRING@\"
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME \"@PACKAGE_TARNAME@\"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL \"@PACKAGE_URL@\"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION \"@PACKAGE_VERSION@\"
+
+/* defined by autotools package */
+#define PACKAGE \"@PACKAGE@\"
+#define VERSION \"@VERSION@\"
+")
+endmacro(autopackage)
+
+#
# parses config.h template and create cmake equivalent
# not implemented yet
#