Howdy,
As promised, attached is my attempt to merge Alex's MacroLogFeature() and the
MacroLogRequirement()
I posted here a few weeks back. Basically, you pass a variable that says
whether a feature is a requirement.
There are also new variables for Minimum_Version and Comments.
Also attached is how one would change FindQtDBus.cmake to use the new macro.
Output will look like the following now (looks best with fixed-width font):
.....
-- Performing Test __KDE_HAVE_GCC_VISIBILITY - Success
-- Found KDE4 kconfig_compiler preprocessor:
/data/kde/trunk/KDE/kdelibs/build-gcc/bin/./kconfig_compiler.sh
--
Missing Requirements:
=======================================
PACKAGE: D-BUS
DESCRIPTION: D-BUS message bus system
URL: http://www.freedesktop.org/wiki/Software_2fdbus
VERSION: 0.62
COMMENTS: If you have dbus installed, check PKG_CONFIG_PATH so that
'pkg-config --libs dbus-1' works. See also the PORTING-TO-DBUS.txt file in
kdelibs/
=======================================
PACKAGE: QtDBus
DESCRIPTION: Qt4 D-BUS Bindings
URL: $SVNROOT/trunk/kdesupport
VERSION: SVN
COMMENTS: If you have qt-dbus installed, check PKG_CONFIG_PATH so that
'pkg-config --libs dbus-qt4-1' works. See also the PORTING-TO-DBUS.txt file in
kdelibs/
=======================================
Exiting: Missing Requirements
-- Configuring done
Comments? Commit or not?
-Allen
--
Let's Keep the Political Talk Out of KDE PLEASE
# This file defines two macros:
#
# MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL MIN_VERSION COMMENTS)
# Logs the information so that it can be displayed at the end
# of the configure run
# VAR : TRUE or FALSE, indicating whether the feature is supported
# FEATURE: name of the feature, e.g. "libjpeg"
# DESCRIPTION: description what this feature provides
# URL: home page
# REQUIRED: TRUE or FALSE, indicating whether the featue is required
# MIN_VERSION: minimum version number. empty string if unneeded
# COMMENTS: More info you may want to provide. empty string if unnecessary
#
# MACRO_DISPLAY_FEATURE_LOG()
# Call this to display the collected results.
# Exits CMake with a FATAL error message if a required feature is missing
#
# Example:
#
# INCLUDE(MacroLogFeature)
#
# FIND_PACKAGE(JPEG)
# MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images"
"http://www.ijg.org" TRUE "3.2a" "")
# ...
# MACRO_DISPLAY_FEATURE_LOG()
MACRO(MACRO_LOG_FEATURE _var _package _description _url _required _minvers
_comments)
IF (${_var})
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt )
ELSE (${_var})
IF (${_required})
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
ELSE (${_required})
SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
ENDIF (${_required})
ENDIF (${_var})
IF (NOT EXISTS ${_LOGFILENAME})
FILE(WRITE ${_LOGFILENAME} "\n")
ENDIF (NOT EXISTS ${_LOGFILENAME})
FILE(APPEND "${_LOGFILENAME}" "=======================================\n")
FILE(APPEND "${_LOGFILENAME}" "PACKAGE: ${_package}\n")
FILE(APPEND "${_LOGFILENAME}" "DESCRIPTION: ${_description}\n")
FILE(APPEND "${_LOGFILENAME}" "URL: ${_url}\n")
IF (${_minvers} MATCHES ".*")
FILE(APPEND "${_LOGFILENAME}" "VERSION: ${_minvers}\n")
ENDIF (${_minvers} MATCHES ".*")
IF (${_comments} MATCHES ".*")
FILE(APPEND "${_LOGFILENAME}" "COMMENTS: ${_comments}\n")
ENDIF (${_comments} MATCHES ".*")
ENDMACRO(MACRO_LOG_FEATURE)
MACRO(MACRO_DISPLAY_FEATURE_LOG)
SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt )
IF (EXISTS ${_file})
FILE(APPEND ${_file} "=======================================")
FILE(READ ${_file} _requirements)
MESSAGE(STATUS "\nMissing Requirements:${_requirements}")
FILE(REMOVE ${_file})
MESSAGE(FATAL_ERROR "Exiting: Missing Requirements")
ENDIF (EXISTS ${_file})
SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt )
IF (EXISTS ${_file})
FILE(APPEND ${_file} "=======================================")
FILE(READ ${_file} _enabled)
MESSAGE(STATUS "\nEnabled Features:${_enabled}")
FILE(REMOVE ${_file})
ENDIF (EXISTS ${_file})
SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt )
IF (EXISTS ${_file})
FILE(APPEND ${_file} "=======================================")
FILE(READ ${_file} _disabled)
MESSAGE(STATUS "\nDisabled Features:${_disabled}")
FILE(REMOVE ${_file})
ENDIF (EXISTS ${_file})
ENDMACRO(MACRO_DISPLAY_FEATURE_LOG)
Index: FindQtDBus.cmake
===================================================================
--- FindQtDBus.cmake (revision 554394)
+++ FindQtDBus.cmake (working copy)
@@ -19,6 +19,7 @@
# QDBUS_ADD_ADAPTORS(SRC_VAR file1.xml ... fileN.xml)
# Generates adaptor code from the given XML files.
#
+INCLUDE(MacroLogFeature)
if (QDBUS_INCLUDE_DIRS AND QDBUS_LIBRARIES)
@@ -51,20 +52,17 @@ else (QDBUS_INCLUDE_DIRS AND QDBUS_LIBRA
PKGCONFIG("dbus-1" _dbusIncDir _dbusLinkDir _dbusLinkFlags _dbusCflags)
if (NOT _dbusIncDir)
- message(STATUS "You need D-BUS 0.62 or newer.")
- message(STATUS "If you have dbus installed, check PKG_CONFIG_PATH so that 'pkg-config --libs dbus-1' works")
- message(STATUS "See also the PORTING-TO-DBUS.txt file in kdelibs/")
- message(FATAL_ERROR "Could NOT find DBus")
+ MACRO_LOG_FEATURE(0 "D-BUS" "D-BUS message bus system" "http://www.freedesktop.org/wiki/Software_2fdbus" 1 "0.62" "If you have dbus installed, check PKG_CONFIG_PATH so that 'pkg-config --libs dbus-1' works. See also the PORTING-TO-DBUS.txt file in kdelibs/")
endif (NOT _dbusIncDir)
PKGCONFIG("dbus-qt4-1" _qdbusIncDir _qdbusLinkDir _qdbusLinkFlags _qdbusCflags)
if (NOT _qdbusIncDir)
- message(STATUS "You need the Qt4 bindings for dbus. The current recommendation is to install them from kdesupport.")
- message(STATUS "If you have qt-dbus installed, check PKG_CONFIG_PATH so that 'pkg-config --libs dbus-qt4-1' works")
- message(STATUS "See also the PORTING-TO-DBUS.txt file in kdelibs/")
- message(FATAL_ERROR "Could NOT find qt-dbus")
+ MACRO_LOG_FEATURE(0 "QtDBus" "Qt4 D-BUS Bindings" "$SVNROOT/trunk/kdesupport" 1 "SVN" "If you have qt-dbus installed, check PKG_CONFIG_PATH so that 'pkg-config --libs dbus-qt4-1' works. See also the PORTING-TO-DBUS.txt file in kdelibs/")
endif (NOT _qdbusIncDir)
+ # report and exit here if qbus or qtdbus not found
+ MACRO_DISPLAY_FEATURE_LOG()
+
set(QDBUS_DEFINITIONS ${_dbusCflags} ${_qdbusCflags} CACHE INTERNAL "Definitions for Qt DBUS")
set(QDBUS_INCLUDE_DIRS ${_dbusIncDir} ${_qdbusIncDir} CACHE INTERNAL "Include dirs for Qt DBUS")
_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem