Try to read the libdivecomputer.la file (created by GNU libtool)

Getting dependency information for static libraries requires extra
files. Libtool creates .la files, which are "industry standard". qmake
has its own .prl files, but it can create .la in a pinch if necessary.

This change allows us to get the actual dependency information from
libdivecomputer, without having to guess whether it linked to something
else or not. If it changes in the future, we shouldn't have to do
anything.

Signed-off-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Thiago Macieira 2013-10-09 17:40:25 -07:00 committed by Dirk Hohndel
parent cf2dc742f4
commit 1a98e049dc

View file

@ -42,20 +42,28 @@ PKG_CONFIG_OUT = $$system(pkg-config --version 2> $$NUL)
# find it next to our sources
INCLUDEPATH += ../libdivecomputer/include
LIBS += ../libdivecomputer/src/.libs/libdivecomputer.a
LIBDC_LA = ../libdivecomputer/src/libdivecomputer.la
} else:exists(/usr/local/lib/libdivecomputer.a) {
LIBS += /usr/local/lib/libdivecomputer.a
LIBDC_LA = /usr/local/lib/libdivecomputer.la
} else:exists(/usr/local/lib64/libdivecomputer.a) {
LIBS += /usr/local/lib64/libdivecomputer.a
LIBDC_LA = /usr/local/lib64/libdivecomputer.la
} else:link_pkgconfig {
# find it via pkg-config
PKGCONFIG += libdivecomputer
# find it via pkg-config, but we need to pass the --static flag,
# so we can't use the PKGCONFIG variable.
LIBS += $$system("pkg-config --static --libs libdivecomputer")
LIBDC_CFLAGS = $$system("pkg-config --static --cflags libdivecomputer")
QMAKE_CFLAGS += $$LIBDC_CFLAGS
QMAKE_CXXFLAGS += $$LIBDC_CFLAGS
unset(LIBDC_CFLAGS)
}
# Libusb-1.0 is only required if libdivecomputer was built with it.
# And libdivecomputer is only built with it if libusb-1.0 is
# installed. So get libusb if it exists, but don't complain
# about it if it doesn't.
link_pkgconfig: packagesExist(libusb-1.0): PKGCONFIG += libusb-1.0
!isEmpty(LIBDC_LA):exists($$LIBDC_LA) {
# Source the libtool .la file to get the dependent libs
LIBS += $$system(". $$LIBDC_LA && echo \$dependency_libs")
unset(LIBDC_LA)
}
#
# Find libxml2 and libxslt