[Development] Installing Qt5Config.cmake from the Qt repo?

Thiago Macieira thiago.macieira at intel.com
Thu Nov 3 09:46:38 CET 2011


On Wednesday, 2 de November de 2011 23:29:39 Stephen Kelly wrote:
> Then module support in qmake works exactly the same as how cmake config
> files work. If Qt5WidgetsConfig.cmake is missing, Qt5Widgets is not
> available.

Note what you said here.

> > > 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?

See above. Qt5Webkit is available if and only if the file Qt5WebkitConfig.cmake 
is present.

So for each Qt5*Config.cmake file present, there's a module available. I don't 
need to have a list: all we need is something that searches for all 
Qt5*Config.cmake files and sets the variable.

There's a way to do it without searching, though. See below.

> 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.

The contents of Qt Essentials is known. The contents of Qt Addons is not. You 
need to search for them.

> 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()
> 
> ?

I'd like that, but as I said before, I don't mind having to list the optional 
modules listed in the find_package line. That way, the list of modules to be 
searched is always present and not behind any "if" statement. They are either 
in the find_package or in unconditional qt5_add_module calls.

If we implement it that way, there is no globbing. The list of modules whose 
state we want to know is unconditional.

> 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).

Is it searching for QtLocations as well? How about QtPim? I also want it to be 
usable for the module someone might add tomorrow or next month.

> > > 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.

Uh... "exactly" would usually mean that you're telling me that my explanation 
matches exactly what you were thinking, but I don't think it matches what you 
had said above: essentials and addons are a platform definition; mandatory and 
optional are per project being compiled.

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center
     Intel Sweden AB - Registration Number: 556189-6027
     Knarrarnäsgatan 15, 164 40 Kista, Stockholm, Sweden
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20111103/52e93f35/attachment.sig>


More information about the Development mailing list