Merged: MacroLogFeature and MacroLogRequirement

Allen Winter winter at kde.org
Sat Jun 24 01:44:26 CEST 2006


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
-------------- next part --------------
# 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)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FindQtDBus.cmake.diff
Type: text/x-diff
Size: 2240 bytes
Desc: not available
Url : http://mail.kde.org/pipermail/kde-buildsystem/attachments/20060623/0173cb77/attachment.bin 


More information about the Kde-buildsystem mailing list