About PACKAGE_VERSION

Aleksander Morgado aleksander at aleksander.es
Mon Mar 8 13:38:35 UTC 2021


Hey Sai,

> I am trying to understand libqmi and started looking at QMICLI.
> https://gitlab.freedesktop.org/awilfox/libqmi/-/blob/qmi-1-24/src/qmicli/qmicli.c
>
> In this, I am wondering from where QMICLI gets the PACKAGE_VERSION information.
> If I include the libqmi library and try to print PACKAGE_VERSION, I get a compiler error, though other QMI APIs seem to be included without issues.
>

The PACKAGE_VERSION is a symbol that is included in the "config.h"
header during build of the project, generated from the qmi_version
symbol defined in configure.ac. This "config.h" header is NOT
installed, so not part of the API; it's only available during build
because it's specific to your own build.

If you want to have a symbol giving you the library version, you can
use https://www.freedesktop.org/software/libqmi/libqmi-glib/latest/libqmi-glib-Version-and-feature-checks.html#QMI-MAJOR-VERSION:CAPS,
https://www.freedesktop.org/software/libqmi/libqmi-glib/latest/libqmi-glib-Version-and-feature-checks.html#QMI-MINOR-VERSION:CAPS,
and https://www.freedesktop.org/software/libqmi/libqmi-glib/latest/libqmi-glib-Version-and-feature-checks.html#QMI-MICRO-VERSION:CAPS

> Also, cannot find the definition for this "qmicli_read_device_expected_data_format_from_string()". It is just used directly in device_set_expected_data_format_cb(). Am I missing something?

That method is generated via the magic QMICLI_ENUM_LIST macro here:
https://gitlab.freedesktop.org/mobile-broadband/libqmi/-/blob/master/src/qmicli/qmicli-helpers.h#L35

-- 
Aleksander
https://aleksander.es


More information about the libqmi-devel mailing list