[Development] Installing Qt5Config.cmake from the Qt repo?
Stephen Kelly
stephen.kelly at kdab.com
Wed Nov 2 23:29:39 CET 2011
On Wednesday, November 02, 2011 18:40:23 Thiago Macieira wrote:
> On Wednesday, 2 de November de 2011 18:12:58 Stephen Kelly wrote:
> > This then introduces the problem of where does FindQt5.cmake get
> > installed from? It would have to be in CMake itself. Seems like an odd
> > thing to do just for the purpose of keeping a list out of
> > Qt5Config.cmake.
>
> That's a good point. But I'd like searching, not listing. Or like the module
> support in qmake: open a file that is supposed to be there. If the file is
> missing, then the module is not installed.
Then module support in qmake works exactly the same as how cmake config files
work. If Qt5WidgetsConfig.cmake is missing, Qt5Widgets is not available.
>
> > So I can just change it to this:
> >
> > if (NOT Qt5_FIND_COMPONENTS)
> >
> > # By default we look all Qt modules
> > set(Qt5_FIND_COMPONENTS
> >
> > Core
> > Gui
> > Widgets
> > Webkit
> > # TODO: Add the others
> >
> > )
> >
> > endif()
>
> How do you list the modules that don't exist yet and don't have a name?
I think I don't understand the question. The arguments to set() don't need to
exist as targets. They can be considered as strings. The above can even be
written like this:
set(Qt5_FIND_COMPONENTS
"Core"
"Gui"
"Widgets"
"Webkit"
# TODO: Add the others
)
Does that answer your question? Later in that file we do something like
find_package(Qt5${item}Config)
for each item in that list.
>
> > If the list has to be maintained somewhere, it only makes sense to
> > maintain it in Qt.
>
> There is no list.
You're either contradicting your expectations set out perviously or just
confusing me.
How do you expect this to work if Qt5Webkit is not part of any list?
find_package(Qt5)
if (Qt5Webkit_FOUND)
# ...
endif()
How would find_package(Qt5) know to even look for QtWebkit if there was no
list?
>
> Well... there is a "Qt 5.x" release, which has a list of components tested
> and released. But I was hoping that the CMake support would work for other
> addons, modules that aren't part of that release.
>
Sure it will. The Qt5.x release does not contain QtWebkit, and yet both
find_package(Qt5 COMPONENTS Webkit)
and
find_package(Qt5Webkit)
will work.
find_package(Qt5)
if (Qt5Webkit_FOUND)
# ...
endif()
could also be made to work if find_package(Qt5) knows to look for it. As
QtWebkit is not part of the Qt 5.x releases though, I don't know if it should.
Of course, we can also make
find_package(Qt5 COMPONENTS QtEssentials)
find all essentials and
find_package(Qt5 COMPONENTS QtAddons)
find all addons, but again, there would need to be a list somewhere to tell
find_package(Qt5) what is part of each set.
> Then again... those addons have their own version numbers. We'd have to have
> something like pkg-config:
>
> qt5_add_modules(mytarget Gui AddonFoo >= 1.1 AddonBar == 2.0)
>
> Or if you tell me that the "cmake way" is to write:
>
> find_package(Qt5 VERSION 5.1)
> find_package(Qt5AddonFoo VERSION 1.1)
> find_package(Qt5AddonBar VERSION 2.0)
Yes.
>
> Then I will defer to you. But then Qt5Config.cmake should really be for
> qtbase only. Qt Quick and QtWebKit versions are already on a different pace
> and number.
I'm not opposed to that, but it's something we can visit later once things are
working and try-out-able.
>
> I like my solution better.
>
> > > But I don't mind having to declare the *optional* packages, the ones
> > > that I
> > > will use conditionals on. What I don't want is to have to do the
> > > double- booking of the mandatory ones.
In light of what you say I below and after re-reading your email from this
afternoon which led to this fragment, I don't understand this statement.
You want this ? :
find_package(Qt5)
# mylib has a hard dependency on Widgets.
qt5_add_module(mylib Widgets)
# mylib has a soft dependency on Webkit.
if (Qt5Webkit_FOUND)
qt5_add_module(mylib Webkit)
endif()
?
That is already the current state if find_package(Qt5) knows to look for
Widgets and Webkit (apart from the non-existance of the qt5_add_module macro).
> >
> > By 'mandatory' and 'optional' you mean QtEssentials vs QtAddons?
>
> No. I mean in the sense from KDE: mandatory packages must be installed or my
> project will not compile; optional packages add extra functionality, but
> its absence does not stop the build.
>
> Qt Essentials are modules that must be present for a platform to call itself
> a Qt 5 platform. However, it's possible to have platforms with only a
> partial set of modules -- it just cannot call itself a Qt 5 platform. Think
> of small embedded devices that don't need QtWebKit or Qt Quick.
Exactly.
Thanks,
--
Stephen Kelly <stephen at kdab.com> | Software Engineer
KDAB (Deutschland) GmbH & Co.KG, a KDAB Group Company
www.kdab.com || Germany +49-30-521325470 || Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-Independent Software Solutions
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20111102/7479bd67/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20111102/7479bd67/attachment.sig>
More information about the Development
mailing list