Hi, attached you can find a ruby script which helps with creating simple standard FindFoo.cmake files, a sample generated file is also attached. Both these files are in KDE svn (http://websvn.kde.org/trunk/KDE/kdesdk/cmake/modules/). Can you please check that the attached FindLibXml2.cmake follows all your rules for cmake modules, so that nothing would have to be changed to have it included in cmake cvs ? The reason I ask is because this file was generated using the attached script. In the case that KDE decides to use cmake as official buildsystem, there will probably a lot of FindFoo.cmake files be generated using this script. So I'd like to get some input whether the generated file is ok as it is now or whether there are some things wrong. Especially please have a look at how _FIND_REQUIRED and _FIND_QUIETLY are handled. Also attached you can find a cmake module for using information from pkgconfig. Do you think it could be improved by putting some variables in the cache ? If so, how ? Thanks Alex
-- DSL-Aktion wegen großer Nachfrage bis 28.2.2006 verlängert: GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl
generate_findpackage_file
Description: application/ruby
# - Try to find LibXml2
# Once done this will define
#
# LIBXML2_FOUND - system has LibXml2
# LIBXML2_INCLUDE_DIR - the LibXml2 include directory
# LIBXML2_LIBRARY - Link these to use OpenGL and GLU
# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2
#
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
INCLUDE(UsePkgConfig)
PKGCONFIG(libxml-2.0 _LibXml2IncDir _LibXml2LinkDir _LibXml2LinkFlags
_LibXml2Cflags)
SET(LIBXML2_DEFINITIONS ${_LibXml2Cflags})
FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h
${_LibXml2IncDir}/libxml2
/usr/include/libxml2
/usr/local/include/libxml2
)
FIND_LIBRARY(LIBXML2_LIBRARY NAMES xml2
PATHS
${_LibXml2LinkDir}
/usr/lib
/usr/local/lib
)
IF(LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARY)
SET(LIBXML2_FOUND TRUE)
ENDIF(LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARY)
IF(LIBXML2_FOUND)
IF(NOT LibXml2_FIND_QUIETLY)
MESSAGE(STATUS "Found LibXml2: ${LIBXML2_LIBRARY}")
ENDIF(NOT LibXml2_FIND_QUIETLY)
ELSE(LIBXML2_FOUND)
IF(LibXml2_FIND_REQUIRED)
MESSAGE(SEND_ERROR "Could not find LibXml2")
ENDIF(LibXml2_FIND_REQUIRED)
ENDIF(LIBXML2_FOUND)
# - pkg-config module for CMake
# Defines the following macros:
# PKGCONFIG(package includedir libdir linkflags cflags)
# - Calling PKGCONFIG will fill the desired information into the 4 given
arguments,
# e.g. PKGCONFIG(libart-2.0 LIBART_INCLUDE_DIR LIBART_LINK_DIR
LIBART_LINK_FLAGS LIBART_CFLAGS)
# if pkg-config was not found or the specified software package doesn't
exist, the
# variable will be empty when the function returns, otherwise they will
contain the respective information
FIND_PROGRAM(PKGCONFIG_EXECUTABLE NAMES pkg-config PATHS /usr/local/bin )
MACRO(PKGCONFIG _package _include_DIR _link_DIR _link_FLAGS _cflags)
# reset the variables at the beginning
SET(${_include_DIR})
SET(${_link_DIR})
SET(${_link_FLAGS})
SET(${_cflags})
# if pkg-config has been found
IF(PKGCONFIG_EXECUTABLE)
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --exists RETURN_VALUE
_return_VALUE )
# and if the package of interest also exists for pkg-config, then get the
information
IF(NOT _return_VALUE)
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package}
--variable=includedir OUTPUT_VARIABLE ${_include_DIR} )
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --variable=libdir
OUTPUT_VARIABLE ${_link_DIR} )
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --libs-only-other
OUTPUT_VARIABLE ${_link_FLAGS} )
EXEC_PROGRAM(${PKGCONFIG_EXECUTABLE} ARGS ${_package} --cflags-only-other
OUTPUT_VARIABLE ${_cflags} )
ENDIF(NOT _return_VALUE)
ENDIF(PKGCONFIG_EXECUTABLE)
ENDMACRO(PKGCONFIG _include_DIR _link_DIR _link_FLAGS _cflags)
_______________________________________________ CMake mailing list [email protected] http://www.cmake.org/mailman/listinfo/cmake
