[oe] [meta-qt5] Problems with Qt5 and CMake
Manuel Nickschas
manuel.nickschas at bmw-carit.de
Thu Jun 20 10:06:31 UTC 2013
On Monday 10 June 2013 20:32:27 Stefan Herbrechtsmeier wrote:
> Am 10.06.2013 16:09, schrieb Manuel Nickschas:
> > On Friday 24 May 2013 16:56:41 Stefan Herbrechtsmeier wrote:
> >> All paths in the target sysroot represents the path on the target. They
> >> should be
> >> adapted via an variable or automatically detected during runtime.
> >
> > What would be the proper way of doing this in the CMake files shipped
by
> > Qt5?
> >
> > /usr/bin/qt5/moc is hard-coded. We could prepend that with
> > ${STAGING_DIR_NATIVE} maybe, which could be exported (via
> > EXTRA_OECMAKE) by recipes so it's picked up by CMake, and it would
> > resolve to nothing if it's not set (so the CMake file would still work
> > outside of Bitbake).
>
> You can try to import the executable from a file passed via -P parameter
> to cmake. I'm not sure if this works.
It does not; -P is for processing a cmake script (see -E), but you can't use it
to prepend a normal cmake file, unfortunately. I didn't find any other option
that would allow to do that, either.
> add_executable(Qt5::rcc IMPORTED)
> set_target_properties(Qt5::rcc PROPERTIES IMPORTED_LOCATION
> "${STAGING_BINDIR_NATIVE}/rcc4")
This gave me the idea for an ugly workaround at least; I can overwrite the
location in my project's CMakeLists.txt after processing
find_package(Qt5Core). Or I could check if something like qtpaths.cmake
exists in the source dir and include that conditionally at this point.
To avoid Yocto-specific hacks ending up in the upstream repo, I think the
best workaround for now would be to have my recipe patch the
CMakeLists.txt to include a generated file that overwrites the locations.
But this really should be properly fixed in meta-qt5, by modifying the
relevant *Config.cmake files in such a way that the native tools are used
when something is built by Bitbake (e.g. by setting some variable), and the
target tools in case someone compiles manually on the target. We
shouldn't force developers to have to include hackish workarounds in their
own recipes, or worse, their upstream code. With the proliferation of Qt5 in
the embedded space, and the fact that CMake is the de-facto build system
for Qt-based things these days, it's a problem that will come up quite often
in the future and deserves a global solution.
Cheers,
~ Sput
--
Manuel "Sput" Nickschas * Development Specialist, Team GENIVI
BMW Car IT GmbH * http://www.bmw-carit.de
Embedded Software House Ulm * Lise-Meitner-Str. 14 * 89081 Ulm
-----------------------------------------------------------------------------
BMW Car IT GmbH
Geschäftsführer: Harald Heinecke und Reinhard Stolle
Sitz und Registergericht: München HRB 134810
-----------------------------------------------------------------------------
More information about the Openembedded-devel
mailing list