Automatic recording of required packages...

Alexander Neundorf neundorf at kde.org
Sun Oct 31 13:40:39 CET 2010


Hi,

the upcoming 2.8.3 release of cmake (_please_ test the rc4) will have an 
improved logging for find_package() calls.
Together with the enhanced FeatureSummary.cmake module of cmake 2.8.3 it can 
produce a text file which contains which packages where found and which were 
not found for each find_package() call in a project, no further work required 
(except one call to feature_summary() at the end of the toplevel 
CMakeLists.txt

This is already supported in MacroLogFeature.cmake in kdelibs.
The result of this is a file ${CMAKE_BINARY_DIR}/FindPackageLog.txt, I 
attached such a file (FindPackageLog.txt) from one of my builds.

If you look at this file, you may notice that in the list of packages which 
have been found it is not recorded whether the package was optional or 
required.

So I enhanced this a bit more, which resulted in FindPackageLog.txt-required.
Maybe you see the problem, basically all packages are listed as "OPTIONAL", 
while I guess not all of them are optional.
The problem is our macro macro_log_feature(), or more to the point 
the "REQUIRED" argument for macro_log_feature().
This is how we use that:

find_package(ZLIB)
macro_log_feature(ZLIB_FOUND
                  "ZLib" 
                  "The Zlib compression library"
                  "http://www.zlib.net" 
                  TRUE 
                  "" 
           "Required by the core KDE libraries and some critical kioslaves.")

Here this argument is set to TRUE.
So also if ZLIB has not been found, cmake processing continues, and if at the 
end some packages which were marked this way as "REQUIRED" have not been 
found, an according error message is printed and cmake exits with an error.

This has two problem: cmake processing continues, while some variables which 
are expected to be set (e.g. ZLIB_INCLUDE_DIR) are used in CMakeLists.txt 
expecting that they are set to a valid location since ZLIB is REQUIRED, but 
they are not. Same for library or other variables. This can cause other cmake 
errors.

The second problem is what you see in FindPackageLog.txt-required . Basically 
all our packages are listed as OPTIONAL there.

I never liked this "REQUIRED" argument for macro_log_package(), and now I like 
it even less.
We tried to outsmart/work around cmake behaviour instead of going for a proper 
solution.

So, where am I going with this...

I think I'd like to propose that macro_log_feature() ignores the REQUIRED 
keyword (we can't simply remove it due to compatibility reasons) and that we 
use REQUIRED in the find_package() calls instead.

Pros: 
- correct listing of all found and not-found packages by FeatureSummary.cmake
- cmake stops processing when something is REQUIRED has not been found

Cons: no summary of multiple missing required packages at the end of the cmake 
run, only the last missing REQUIRED dependency will be printed.

Opinions ?

Alex
-------------- next part --------------
-- Found the following packages:
X11
Threads
Qt4
Automoc4
Perl , "Perl Programming Language" , <http://www.perl.org> , "Required by the KDE buildsystem."
Phonon (required version >= 4.3.80)
ZLIB
Strigi , "A fast and small desktop searching program" , <http://strigi.sourceforge.net> , "Required by some critical kioslaves."
LibAttica
BZip2 , "A high-quality data compressor" , <http://www.bzip.org> , "STRONGLY RECOMMENDED: Provides the ability to read and write bzip2 compressed data files."
LibLZMA
OpenSSL , "A toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols" , <http://openssl.org> , "STRONGLY RECOMMENDED: KDE uses OpenSSL for the bulk of secure communications, including secure web browsing via HTTPS."
Libintl , "Library for message translation" , <http://www.gnu.org/software/gettext> , "STRONGLY RECOMMENDED: Enables KDE to be available in many different languages."
OpenGL , "API for developing portable, interactive 2D and 3D graphics applications" , <http://mesa3d.sourceforge.net> , "STRONGLY RECOMMENDED: The 3D hardware acceleration available through the OpenGL API is used in applications ranging from graphics and modellers to screensavers and video players."
Soprano (required version >= 2.5.60) , "Semantic Desktop Storing" , <http://soprano.sourceforge.net> , "Provide metadata support (for semantic desktop)."
SharedDesktopOntologies (required version >= 0.5)
DBusMenuQt , "API to import export QMenu instance using DBusMenu protocol" , <git clone git://gitorious.org/dbusmenu/dbusmenu-qt.git> , "dbusmenu-qt is a standalone library providing a way to import and export QMenu instances using the DBusMenu protocol."
ACL
FAM , "File Alteration Monitor" , <http://oss.sgi.com/projects/fam> , "Provides file alteration notification facilities using a separate service."
PCRE , "Perl Compatible Regular Expression" , <http://www.pcre.org> , "Lack of PCRE will result in extremely poor regular expression support in KJS. "
Flex , "Fast lexical analyser generator" , <http://flex.sourceforge.net> , "Needed to build the Solid predicate parser."
LibXslt
LibXml2
DocBookXML
DocBookXSL
SharedMimeInfo
ASPELL
JPEG
GIF
PNG
OpenEXR , "A library for manipulating OpenEXR image files" , <http://www.openexr.com> , "Provides support for OpenEXR images."
-- Did not find the following packages:
KDE4Internal
PkgConfig
QCA2 , "Qt Cryptographic Architecture" , <http://delta.affinix.com/qca> , "Needed for the plasma remote widgets functionality."
Grantlee , "Grantlee template system" , <http://www.grantlee.org> , "Required for the model logging feature"
HUpnp
GSSAPI , "Generic Security Services API" , <http://web.mit.edu/kerberos/www> , "A MIT or HEIMDAL flavor of GSSAPI to provide HTTP authentication services."
HSPELL
ENCHANT
Jasper
Avahi , "For Linux and BSDs: a system which facilitates service discovery on a local network, based on the Zeroconf standard" , <http://avahi.org> , "Enables KDE applications access to multicast DNS/DNS-SD service discovery."
DNSSD , "For MacOS and platforms without Avahi: A system which facilitates service discovery on a local network, based on the Zeroconf standard" , <http://www.zeroconf.org> , "Enables KDE applications access to multicast DNS/DNS-SD service discovery."
-------------- next part --------------
-- Found the following packages:
X11 , REQUIRED
Threads , OPTIONAL
Qt4 , REQUIRED
Automoc4 , REQUIRED
Perl , OPTIONAL , "Perl Programming Language" , <http://www.perl.org> , "Required by the KDE buildsystem."
Phonon (required version >= 4.3.80) , REQUIRED
ZLIB , OPTIONAL
Strigi , OPTIONAL , "A fast and small desktop searching program" , <http://strigi.sourceforge.net> , "Required by some critical kioslaves."
LibAttica , OPTIONAL
BZip2 , OPTIONAL , "A high-quality data compressor" , <http://www.bzip.org> , "STRONGLY RECOMMENDED: Provides the ability to read and write bzip2 compressed data files."
LibLZMA , OPTIONAL
OpenSSL , OPTIONAL , "A toolkit implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security (TLS v1) protocols" , <http://openssl.org> , "STRONGLY RECOMMENDED: KDE uses OpenSSL for the bulk of secure communications, including secure web browsing via HTTPS."
Libintl , OPTIONAL , "Library for message translation" , <http://www.gnu.org/software/gettext> , "STRONGLY RECOMMENDED: Enables KDE to be available in many different languages."
OpenGL , OPTIONAL , "API for developing portable, interactive 2D and 3D graphics applications" , <http://mesa3d.sourceforge.net> , "STRONGLY RECOMMENDED: The 3D hardware acceleration available through the OpenGL API is used in applications ranging from graphics and modellers to screensavers and video players."
Soprano (required version >= 2.5.60) , OPTIONAL , "Semantic Desktop Storing" , <http://soprano.sourceforge.net> , "Provide metadata support (for semantic desktop)."
SharedDesktopOntologies (required version >= 0.5) , OPTIONAL
DBusMenuQt , OPTIONAL , "API to import export QMenu instance using DBusMenu protocol" , <git clone git://gitorious.org/dbusmenu/dbusmenu-qt.git> , "dbusmenu-qt is a standalone library providing a way to import and export QMenu instances using the DBusMenu protocol."
ACL , OPTIONAL
FAM , OPTIONAL , "File Alteration Monitor" , <http://oss.sgi.com/projects/fam> , "Provides file alteration notification facilities using a separate service."
PCRE , OPTIONAL , "Perl Compatible Regular Expression" , <http://www.pcre.org> , "Lack of PCRE will result in extremely poor regular expression support in KJS. "
Flex , OPTIONAL , "Fast lexical analyser generator" , <http://flex.sourceforge.net> , "Needed to build the Solid predicate parser."
LibXslt , OPTIONAL
LibXml2 , OPTIONAL
DocBookXML , OPTIONAL
DocBookXSL , OPTIONAL
SharedMimeInfo , OPTIONAL
ASPELL , OPTIONAL
JPEG , OPTIONAL
GIF , OPTIONAL
PNG , OPTIONAL
OpenEXR , OPTIONAL , "A library for manipulating OpenEXR image files" , <http://www.openexr.com> , "Provides support for OpenEXR images."
-- Did not find the following packages:
KDE4Internal , REQUIRED
PkgConfig , OPTIONAL
QCA2 , OPTIONAL , "Qt Cryptographic Architecture" , <http://delta.affinix.com/qca> , "Needed for the plasma remote widgets functionality."
Grantlee , OPTIONAL , "Grantlee template system" , <http://www.grantlee.org> , "Required for the model logging feature"
HUpnp , OPTIONAL
GSSAPI , OPTIONAL , "Generic Security Services API" , <http://web.mit.edu/kerberos/www> , "A MIT or HEIMDAL flavor of GSSAPI to provide HTTP authentication services."
HSPELL , OPTIONAL
ENCHANT , OPTIONAL
Jasper , OPTIONAL
Avahi , OPTIONAL , "For Linux and BSDs: a system which facilitates service discovery on a local network, based on the Zeroconf standard" , <http://avahi.org> , "Enables KDE applications access to multicast DNS/DNS-SD service discovery."
DNSSD , OPTIONAL , "For MacOS and platforms without Avahi: A system which facilitates service discovery on a local network, based on the Zeroconf standard" , <http://www.zeroconf.org> , "Enables KDE applications access to multicast DNS/DNS-SD service discovery."


More information about the Kde-buildsystem mailing list