Missing Requirements
Allen Winter
winter at kde.org
Mon Jun 5 18:35:43 CEST 2006
Howdy,
I'd like to commit a new set of macros for dealing (in a pretty, consistent manner) with missing requirements,
as I ran into this morning with dbus and QtDBus.
New macro attached, as well as the change to FindQtDBus.cmake.
Comments?
-Allen
The output of cmake changes from:
============================
-- Configuring done
/usr/local/bin/cmake -H/data/kde/trunk/KDE/kdelibs4_snapshot -B/data/kde/trunk/KDE/kdelibs4_snapshot/build-gcc --check-build-system CMakeFiles/Makefile.cmake 0
Re-run cmake file: Makefile older than: CMakeCache.txt
-- Found Qt-Version 4.1.3
-- Building kdelibs...
-- Found KDE4 kconfig_compiler preprocessor: /data/kde/trunk/KDE/kdelibs4_snapshot/build-gcc/bin/./kconfig_compiler.sh
-- QtDBus Results: QDBUS_LIBRARIES-NOTFOUND /usr/include -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include
-- You need the CVS version of D-BUS library. The one that your distribution installed, even if it's 0.61, probably won't be enough to compile QtDBus.
-- You need the Subversion or CVS version of QtDBus. It's official home is now in trunk/kdesupport/
-- See also the PORTING-TO-DBUS.txt file in kdelibs/
Could NOT find QtDBus
-- Configuring done
To:
=============================
-- Configuring done
/usr/local/bin/cmake -H/data/kde/trunk/KDE/kdelibs -B/data/kde/trunk/KDE/kdelibs/build-gcc --check-build-system CMakeFiles/Makefile.cmake 0
Re-run cmake file: Makefile older than: ../cmake/modules/FindQtDBus.cmake
-- Found Qt-Version 4.1.3
-- Building kdelibs...
-- Found KDE4 kconfig_compiler preprocessor: /data/kde/trunk/KDE/kdelibs/build-gcc/bin/./kconfig_compiler.sh
-- QtDBus Results: QDBUS_LIBRARIES-NOTFOUND /usr/include -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include
--
Missing Requirements:
PACKAGE: dbus
DESCRIPTION: The D-BUS library. See also trunk/kdelibs/PORTING-TO-DBUS.txt
URL: http://freedesktop.org
VERSION: Freedesktop CVS
PACKAGE: QtDBus
DESCRIPTION: The Qt4 D-Bus bindings. See also trunk/kdelibs/PORTING-TO-DBUS.txt
URL: $SVNROOT/trunk/kdesupport/
VERSION: KDE Subversion
Exiting due to missing requirements
-- Configuring done
--
Let's Keep the Political Talk Out of KDE PLEASE
-------------- next part --------------
# - Try to find the QtDBus module
# Once done this will define
#
# QDBUS_FOUND - system has QtDBus
# QDBUS_INCLUDE_DIRS - the QtDBus include directories
# QDBUS_LIBRARIES - Link these to use QtDBus
# QDBUS_DEFINITIONS - Compiler switches required for using QtDBus
#
# QDBUS_IDL2CPP_EXECUTABLE - The adaptor/interface code generator
# QDBUS_CPP2XML_EXECUTABLE - The interface parser
#
# Macros (from QtDBusMacros.cmake):
# QDBUS_ADD_INTERFACES(SRC_VAR file1.xml ... fileN.xml)
# Generates interface code from the given XML files.
#
# QDBUS_GENERATE_INTERFACE(file.h)
# Generates the XML interface description from the given header file.
#
# QDBUS_ADD_ADAPTORS(SRC_VAR file1.xml ... fileN.xml)
# Generates adaptor code from the given XML files.
#
INCLUDE(MacroLogRequirement)
if (QDBUS_INCLUDE_DIRS AND QDBUS_LIBRARIES)
# already in cache
set(QDBUS_FOUND TRUE)
else (QDBUS_INCLUDE_DIRS AND QDBUS_LIBRARIES)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
INCLUDE(UsePkgConfig)
PKGCONFIG("dbus-1" _dbusIncDir _dbusLinkDir _dbusLinkFlags _dbusCflags)
PKGCONFIG("dbus-qt4-1" _qdbusIncDir _qdbusLinkDir _qdbusLinkFlags _qdbusCflags)
set(QDBUS_DEFINITIONS ${_dbusCflags} ${_qdbusCflags} CACHE INTERNAL "Definitions for Qt DBUS")
set(QDBUS_INCLUDE_DIRS ${_dbusIncDir} ${_qdbusIncDir} CACHE INTERNAL "Include dirs for Qt DBUS")
FIND_LIBRARY(QDBUS_LIBRARIES NAMES dbus-qt4-1
PATHS ${_qdbusLinkDir}
)
if (QDBUS_INCLUDE_DIRS AND QDBUS_LIBRARIES)
set(QDBUS_FOUND TRUE)
endif (QDBUS_INCLUDE_DIRS AND QDBUS_LIBRARIES)
message(STATUS "QtDBus Results: ${QDBUS_LIBRARIES} ${QDBUS_INCLUDE_DIRS} ${QDBUS_DEFINITIONS}")
if (QDBUS_FOUND)
if (NOT QDBUS_FIND_QUIETLY)
message(STATUS "Found QtDBus: ${QDBUS_LIBRARIES}")
endif (NOT QDBUS_FIND_QUIETLY)
else (QDBUS_FOUND)
MACRO_LOG_REQUIREMENT(QDBUS_FOUND "dbus" "The D-BUS library. See also trunk/kdelibs/PORTING-TO-DBUS.txt" "http://freedesktop.org" "Freedesktop CVS")
MACRO_LOG_REQUIREMENT(QDBUS_FOUND "QtDBus" "The Qt4 D-Bus bindings. See also trunk/kdelibs/PORTING-TO-DBUS.txt" "$SVNROOT/trunk/kdesupport/" "KDE Subversion")
MACRO_DISPLAY_REQUIREMENT_LOG()
endif (QDBUS_FOUND)
endif(QDBUS_INCLUDE_DIRS AND QDBUS_LIBRARIES)
find_program(QDBUS_IDL2CPP_EXECUTABLE NAME dbusidl2cpp PATHS)
find_program(QDBUS_CPP2XML_EXECUTABLE NAME dbuscpp2xml PATHS)
include( QtDBusMacros )
-------------- next part --------------
# This file defines two macros:
# MACRO_LOG_REQUIREMENT(VAR REQUIREMENT DESCRIPTION URL MIN_VERSION)
# Logs the information so that it can be displayed when desired.
# VAR : variable which is TRUE or FALSE indicating whether the requirement is missing
# REQUIREMENT: name of the requirement, e.g. "libjpeg"
# DESCRIPTION: description of the requirement
# URL: home page
# MIN_VERSION: (optional) minimum version number
#
# MACRO_DISPLAY_REQUIREMENT_LOG()
# Call this as needed to display the collected results
#
# Example:
#
# INCLUDE(MacroLogRequirement)
#
# FIND_PACKAGE(JPEG)
# MACRO_LOG_REQUIREMENT(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" "")
# ...
# MACRO_DISPLAY_REQUIREMENT_LOG()
# ...
MACRO(MACRO_LOG_REQUIREMENT _var _package _description _url _minvers)
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt )
IF (NOT EXISTS ${_LOGFILENAME})
FILE(WRITE ${_LOGFILENAME} "\n")
ENDIF (NOT EXISTS ${_LOGFILENAME})
IF (NOT ${_var})
IF (${_minvers} MATCHES ".*")
FILE(APPEND "${_LOGFILENAME}" "\nPACKAGE: ${_package}\nDESCRIPTION: ${_description}\nURL: ${_url}\nVERSION: ${_minvers}\n")
ELSE (${_minvers} MATCHES ".*")
FILE(APPEND "{_LOGFILENAME}" "\nPACKAGE: ${_package}\nDESCRIPTION: ${_description}\nURL: ${_url}\n")
ENDIF (${_minvers} MATCHES ".*")
ENDIF (NOT ${_var})
ENDMACRO(MACRO_LOG_REQUIREMENT)
MACRO(MACRO_DISPLAY_REQUIREMENT_LOG)
IF (EXISTS "${CMAKE_BINARY_DIR}/MissingRequirements.txt")
FILE(READ ${CMAKE_BINARY_DIR}/MissingRequirements.txt _requirements)
MESSAGE(STATUS "\nMissing Requirements:${_requirements}")
FILE(REMOVE ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
MESSAGE(FATAL_ERROR "Exiting due to missing requirements\n")
ENDIF (EXISTS "${CMAKE_BINARY_DIR}/MissingRequirements.txt")
ENDMACRO(MACRO_DISPLAY_REQUIREMENT_LOG)
More information about the Kde-buildsystem
mailing list