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

Alexander Neundorf neundorf at kde.org
Mon Oct 31 22:20:05 CET 2011


On Friday 28 October 2011, Stephen Kelly wrote:
> Hi,
> 
> == Summary ==
> 
> I'm considering adding some cmake files to Qt, which would be installed by
> Qt, and which would make it easier for CMake based projects to depend on
> Qt.
> 
> I'm CC'ing the cmake developers too see what they think of the idea too.
> 
> == Clarification ==
> 
> To avoid misunderstanding:
> 
> * This proposal is not about porting the Qt build system to CMake.
> * This would not make Qt depend on CMake at all
> * I am proposing to add some plain text files to the Qt repo for
> installation * Those plain text files would need to be generated while
> building Qt (using existing mechanisms, like perl).
> 
> == How CMake finds packages ==
> 
> (Skip this section if you already know how CMake finds packages)
> 
> For those who have not used CMake before, it has two ways to find
> dependencies:
> 
> * If you want to find a dependency, you write a Find<Package>.cmake file or
> use an existing one. Usually this Find<Package>.cmake will not be
> installed.
> 
> * If you want to be easily found for others to depend on, you write a
>     <Package>Config.cmake file and install it to a location CMake will use
> to find things like that. I assume this is similar to how pkgconfig works,
> but I have never used pkgconfig.
> 
>     This is most common in the case of projects which use CMake themselves,
>     but there's no reason projects which do not use CMake can't provide
>     similar files. This becomes even more useful with recent CMake features
>     based on finding packages.
> 
> Either way, if someone does this in CMake:
> 
> find_package(Package)
> 
> the result is the ability to use the headers and libraries from Package.
> 
> CMake ships with FindQt4.cmake, so anyone using CMake uses
> 
> find_package(Qt4)
> 
> to be able to use Qt 4.
> 
> == Qt5Config.cmake ==
> 
> I propose that we ship a Qt5Config.cmake file with Qt which we install,
> along with macros equivalent to what is currently in Qt4Macros.cmake, and
> some Targets.cmake files.

Great idea IMO.
You have my full support (but don't count on me rebuilding Qt everyday...)

Not sure what the other cmake developers would think about supporting an 
additional file format for the Config.cmake files, e.g. xml or json, so they 
could be easily used and generated also by other tools. I.e. not only by/for 
cmake, but basically a standard format for installed libraries to provide 
information about themselves.

Something like:
<libs>
  <lib>
     <name>QtCore</name>
     <configs>debug;release</configs>
     <location config="debug">/usr/lib/libQtCore.so</location>
     <include>/usr/include/QtCore</include>
     ...
  </lib>
</libs>


Alex



More information about the Development mailing list