From 47d2c9cc0c6e6602d18e4909d269500a0e58437a Mon Sep 17 00:00:00 2001 From: Dario Freddi Date: Fri, 16 Apr 2010 20:55:08 +0200 Subject: [PATCH 1/3] Avoid using PkgConfig directly - in CMake this is never a good idea as the whole buildsystem is supposed to work also on systems which have no pkgconfig installed. Move the relevant stuff to some Find*.cmake file, add some, and change the relevant link/include dirs to make everything build correctly just like before. --- CMakeLists.txt | 37 +++++++++----- TelepathyQt4/CMakeLists.txt | 4 +- TelepathyQt4/Farsight/CMakeLists.txt | 13 +++-- cmake/modules/FindDBus.cmake | 72 ++++++++++++++++++++++++++ cmake/modules/FindGLIB2.cmake | 55 ++++++++++++++++++++ cmake/modules/FindGStreamer.cmake | 80 +++++++++++++++++++++++++++++ cmake/modules/FindLibXml2.cmake | 57 ++++++++++++++++++++ cmake/modules/FindTelepathyFarsight.cmake | 49 ++++++++++++++++++ cmake/modules/FindTelepathyGlib.cmake | 49 ++++++++++++++++++ examples/call/CMakeLists.txt | 11 +++-- tests/dbus/CMakeLists.txt | 4 +- tests/lib/glib/CMakeLists.txt | 6 ++- 12 files changed, 411 insertions(+), 26 deletions(-) create mode 100644 cmake/modules/FindDBus.cmake create mode 100644 cmake/modules/FindGLIB2.cmake create mode 100644 cmake/modules/FindGStreamer.cmake create mode 100644 cmake/modules/FindLibXml2.cmake create mode 100644 cmake/modules/FindTelepathyFarsight.cmake create mode 100644 cmake/modules/FindTelepathyGlib.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ae8469d..2f16acf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -141,31 +141,42 @@ else(PYTHON_DBUS_RESULT EQUAL 0) set(HAVE_TEST_PYTHON 0) endif(PYTHON_DBUS_RESULT EQUAL 0) -# Optional dependencies -find_package(PkgConfig) +# Find GLib2, DBus and LibXml2 +# Those are needed for the insane include dir dependency hell +find_package(GLIB2) +find_package(DBus) +find_package(LibXml2) # Find tp-farsight -pkg_check_modules(TP_FARSIGHT telepathy-farsight>=0.0.4 gstreamer-0.10 gstreamer-interfaces-0.10) -if(TP_FARSIGHT_FOUND) +set(TELEPATHY_FARSIGHT_MIN_VERSION "0.0.4") +find_package(TelepathyFarsight) +find_package(GStreamer) +if (TELEPATHYFARSIGHT_FOUND AND GSTREAMER_FOUND AND GLIB2_FOUND AND DBUS_FOUND AND LIBXML2_FOUND) + set (FARSIGHT_COMPONENTS_FOUND 1) +else (TELEPATHYFARSIGHT_FOUND AND GSTREAMER_FOUND AND GLIB2_FOUND AND DBUS_FOUND AND LIBXML2_FOUND) + set (FARSIGHT_COMPONENTS_FOUND 0) +endif (TELEPATHYFARSIGHT_FOUND AND GSTREAMER_FOUND AND GLIB2_FOUND AND DBUS_FOUND AND LIBXML2_FOUND) + +if(FARSIGHT_COMPONENTS_FOUND) message(STATUS "telepathy-farsight and gstreamer libraries found, building additional examples") -else(TP_FARSIGHT_FOUND) +else(FARSIGHT_COMPONENTS_FOUND) message(STATUS "telepathy-farsight or gstreamer libraries not found, not building some examples") -endif(TP_FARSIGHT_FOUND) +endif(FARSIGHT_COMPONENTS_FOUND) # Find telepathy-glib -set(REQUIRED_TP_GLIB 0.10.0) -pkg_check_modules(TPGLIB telepathy-glib>=${REQUIRED_TP_GLIB}) +set(TELEPATHY_GLIB_MIN_VERSION 0.10.0) +find_package(TelepathyGlib) find_program(GLIB_GENMARSHAL glib-genmarshal) # process results... -if(QT4_GLIB_SUPPORT AND TPGLIB_FOUND) - message(STATUS "Qt4 compiled with Glib support and telepathy-glib >= ${REQUIRED_TP_GLIB} found, running additional tests") +if(QT4_GLIB_SUPPORT AND TELEPATHYGLIB_FOUND AND GLIB2_FOUND AND DBUS_FOUND) + message(STATUS "Qt4 compiled with Glib support and telepathy-glib >= ${TELEPATHY_GLIB_MIN_VERSION} found, running additional tests") set(ENABLE_TP_GLIB_TESTS 1) -else(QT4_GLIB_SUPPORT AND TPGLIB_FOUND) - message(STATUS "Qt4 not compiled with Glib support or telepathy-glib >= ${REQUIRED_TP_GLIB} not found, skipping some tests") +else(QT4_GLIB_SUPPORT AND TELEPATHYGLIB_FOUND AND GLIB2_FOUND AND DBUS_FOUND) + message(STATUS "Qt4 not compiled with Glib support or telepathy-glib >= ${TELEPATHY_GLIB_MIN_VERSION} not found, skipping some tests") set(ENABLE_TP_GLIB_TESTS 0) -endif(QT4_GLIB_SUPPORT AND TPGLIB_FOUND) +endif(QT4_GLIB_SUPPORT AND TELEPATHYGLIB_FOUND AND GLIB2_FOUND AND DBUS_FOUND) add_subdirectory(TelepathyQt4) add_subdirectory(examples) diff --git a/TelepathyQt4/CMakeLists.txt b/TelepathyQt4/CMakeLists.txt index 4f8b905..a4cd80f 100644 --- a/TelepathyQt4/CMakeLists.txt +++ b/TelepathyQt4/CMakeLists.txt @@ -544,10 +544,10 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TelepathyQt4.pc.in ${CMAKE_CURRENT_BI configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TelepathyQt4-uninstalled.pc.in ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt4-uninstalled.pc) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt4.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) -if(TP_FARSIGHT_FOUND) +if(FARSIGHT_COMPONENTS_FOUND) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TelepathyQt4Farsight.pc.in ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt4Farsight.pc) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/TelepathyQt4Farsight-uninstalled.pc.in ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt4Farsight-uninstalled.pc) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/TelepathyQt4Farsight.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) -endif(TP_FARSIGHT_FOUND) +endif(FARSIGHT_COMPONENTS_FOUND) add_subdirectory(Farsight) diff --git a/TelepathyQt4/Farsight/CMakeLists.txt b/TelepathyQt4/Farsight/CMakeLists.txt index 31b2cbc..aa4fdfe 100644 --- a/TelepathyQt4/Farsight/CMakeLists.txt +++ b/TelepathyQt4/Farsight/CMakeLists.txt @@ -1,8 +1,12 @@ -if(TP_FARSIGHT_FOUND) +if(FARSIGHT_COMPONENTS_FOUND) include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${QT_INCLUDES} - ${TP_FARSIGHT_INCLUDE_DIRS}) + ${TELEPATHY_FARSIGHT_INCLUDE_DIR} + ${GSTREAMER_INCLUDE_DIR} + ${GLIB2_INCLUDE_DIR} + ${LIBXML2_INCLUDE_DIR} + ${DBUS_INCLUDE_DIR}) set(telepathy_qt4_farsight_SRCS channel.cpp) @@ -15,9 +19,10 @@ if(TP_FARSIGHT_FOUND) target_link_libraries(telepathy-qt4-farsight ${QT_QTDBUS_LIBRARY} ${QT_QTCORE_LIBRARY} - ${TP_FARSIGHT_LIBRARIES} + ${TELEPATHY_FARSIGHT_LIBRARIES} + ${GSTREAMER_INTERFACE_LIBRARY} telepathy-qt4) install(TARGETS telepathy-qt4-farsight DESTINATION ${LIB_INSTALL_DIR}) install(FILES ${telepathy_qt4_farsight_HEADERS} DESTINATION ${INCLUDE_INSTALL_DIR}/telepathy-1.0/TelepathyQt4/Farsight) -endif(TP_FARSIGHT_FOUND) +endif(FARSIGHT_COMPONENTS_FOUND) diff --git a/cmake/modules/FindDBus.cmake b/cmake/modules/FindDBus.cmake new file mode 100644 index 0000000..a0b7c3a --- /dev/null +++ b/cmake/modules/FindDBus.cmake @@ -0,0 +1,72 @@ +# - Try to find the low-level D-Bus library +# Once done this will define +# +# DBUS_FOUND - system has D-Bus +# DBUS_INCLUDE_DIR - the D-Bus include directory +# DBUS_ARCH_INCLUDE_DIR - the D-Bus architecture-specific include directory +# DBUS_LIBRARIES - the libraries needed to use D-Bus + +# Copyright (c) 2008, Kevin Kofler, +# modeled after FindLibArt.cmake: +# Copyright (c) 2006, Alexander Neundorf, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES) + + # in cache already + SET(DBUS_FOUND TRUE) + +else (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES) + + IF (NOT WIN32) + FIND_PACKAGE(PkgConfig) + IF (PKG_CONFIG_FOUND) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + pkg_check_modules(_DBUS_PC dbus-1) + ENDIF (PKG_CONFIG_FOUND) + ENDIF (NOT WIN32) + + FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h + ${_DBUS_PC_INCLUDE_DIRS} + /usr/include + /usr/include/dbus-1.0 + /usr/local/include + ) + + FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h + ${_DBUS_PC_INCLUDE_DIRS} + /usr/lib${LIB_SUFFIX}/include + /usr/lib${LIB_SUFFIX}/dbus-1.0/include + /usr/lib64/include + /usr/lib64/dbus-1.0/include + /usr/lib/include + /usr/lib/dbus-1.0/include + ) + + FIND_LIBRARY(DBUS_LIBRARIES NAMES dbus-1 dbus + PATHS + ${_DBUS_PC_LIBDIR} + ) + + + if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES) + set(DBUS_FOUND TRUE) + endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES) + + + if (DBUS_FOUND) + if (NOT DBus_FIND_QUIETLY) + message(STATUS "Found D-Bus: ${DBUS_LIBRARIES}") + endif (NOT DBus_FIND_QUIETLY) + else (DBUS_FOUND) + if (DBus_FIND_REQUIRED) + message(FATAL_ERROR "Could NOT find D-Bus") + endif (DBus_FIND_REQUIRED) + endif (DBUS_FOUND) + + MARK_AS_ADVANCED(DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR DBUS_LIBRARIES) + +endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES) diff --git a/cmake/modules/FindGLIB2.cmake b/cmake/modules/FindGLIB2.cmake new file mode 100644 index 0000000..fbc8b02 --- /dev/null +++ b/cmake/modules/FindGLIB2.cmake @@ -0,0 +1,55 @@ +# - Try to find the GLIB2 libraries +# Once done this will define +# +# GLIB2_FOUND - system has glib2 +# GLIB2_INCLUDE_DIR - the glib2 include directory +# GLIB2_LIBRARIES - glib2 library + +# Copyright (c) 2008 Laurent Montel, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +if(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) + # Already in cache, be silent + set(GLIB2_FIND_QUIETLY TRUE) +endif(GLIB2_INCLUDE_DIR AND GLIB2_LIBRARIES) + +if (NOT WIN32) + find_package(PkgConfig) + if (PKG_CONFIG_FOUND) + pkg_check_modules(PC_LibGLIB2 glib-2.0) + endif (PKG_CONFIG_FOUND) +endif(NOT WIN32) + +if (PC_LibGLIB2_INCLUDEDIR) + set(GLIB2_MAIN_INCLUDE_DIR ${PC_LibGLIB2_INCLUDEDIR}) +else (PC_LibGLIB2_INCLUDEDIR) + find_path(GLIB2_MAIN_INCLUDE_DIR NAMES glib.h PATH_SUFFIXES glib-2.0) +endif (PC_LibGLIB2_INCLUDEDIR) + +# search the glibconfig.h include dir under the same root where the library is found +find_library(GLIB2_LIBRARIES + NAMES glib-2.0 + HINTS ${PC_LibGLIB2_LIBDIR} +) + +get_filename_component(glib2LibDir "${GLIB2_LIBRARIES}" PATH) + +find_path(GLIB2_INTERNAL_INCLUDE_DIR glibconfig.h + PATH_SUFFIXES glib-2.0/include + HINTS ${PC_LibGLIB2_INCLUDEDIR} "${glib2LibDir}" ${CMAKE_SYSTEM_LIBRARY_PATH}) + +set(GLIB2_INCLUDE_DIR "${GLIB2_MAIN_INCLUDE_DIR}") + +# not sure if this include dir is optional or required +# for now it is optional +if(GLIB2_INTERNAL_INCLUDE_DIR) + set(GLIB2_INCLUDE_DIR ${GLIB2_INCLUDE_DIR} "${GLIB2_INTERNAL_INCLUDE_DIR}") +endif(GLIB2_INTERNAL_INCLUDE_DIR) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GLIB2 DEFAULT_MSG GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR) + +mark_as_advanced(GLIB2_INCLUDE_DIR GLIB2_LIBRARIES) diff --git a/cmake/modules/FindGStreamer.cmake b/cmake/modules/FindGStreamer.cmake new file mode 100644 index 0000000..f6c5681 --- /dev/null +++ b/cmake/modules/FindGStreamer.cmake @@ -0,0 +1,80 @@ +# - Try to find GStreamer +# Once done this will define +# +# GSTREAMER_FOUND - system has GStreamer +# GSTREAMER_INCLUDE_DIR - the GStreamer include directory +# GSTREAMER_LIBRARIES - the libraries needed to use GStreamer +# GSTREAMER_DEFINITIONS - Compiler switches required for using GStreamer + +# Copyright (c) 2006, Tim Beaulen +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +# TODO: Other versions --> GSTREAMER_X_Y_FOUND (Example: GSTREAMER_0_8_FOUND and GSTREAMER_0_10_FOUND etc) + +IF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY) + # in cache already + SET(GSTREAMER_FIND_QUIETLY TRUE) +ELSE (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY) + SET(GSTREAMER_FIND_QUIETLY FALSE) +ENDIF (GSTREAMER_INCLUDE_DIR AND GSTREAMER_LIBRARIES AND GSTREAMER_BASE_LIBRARY AND GSTREAMER_INTERFACE_LIBRARY) + +IF (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + FIND_PACKAGE(PkgConfig) + PKG_CHECK_MODULES(PC_GSTREAMER gstreamer-0.10) + #MESSAGE(STATUS "DEBUG: GStreamer include directory = ${GSTREAMER_INCLUDE_DIRS}") + #MESSAGE(STATUS "DEBUG: GStreamer link directory = ${GSTREAMER_LIBRARY_DIRS}") + #MESSAGE(STATUS "DEBUG: GStreamer CFlags = ${GSTREAMER_CFLAGS_OTHER}") + SET(GSTREAMER_DEFINITIONS ${PC_GSTREAMER_CFLAGS_OTHER}) +ENDIF (NOT WIN32) + +FIND_PATH(GSTREAMER_INCLUDE_DIR gst/gst.h + PATHS + ${PC_GSTREAMER_INCLUDEDIR} + ${PC_GSTREAMER_INCLUDE_DIRS} + PATH_SUFFIXES gstreamer-0.10 + ) + +FIND_LIBRARY(GSTREAMER_LIBRARIES NAMES gstreamer-0.10 + PATHS + ${PC_GSTREAMER_LIBDIR} + ${PC_GSTREAMER_LIBRARY_DIRS} + ) + +FIND_LIBRARY(GSTREAMER_BASE_LIBRARY NAMES gstbase-0.10 + PATHS + ${PC_GSTREAMER_LIBDIR} + ${PC_GSTREAMER_LIBRARY_DIRS} + ) + +FIND_LIBRARY(GSTREAMER_INTERFACE_LIBRARY NAMES gstinterfaces-0.10 + PATHS + ${PC_GSTREAMER_LIBDIR} + ${PC_GSTREAMER_LIBRARY_DIRS} + ) + +IF (GSTREAMER_INCLUDE_DIR) + #MESSAGE(STATUS "DEBUG: Found GStreamer include dir: ${GSTREAMER_INCLUDE_DIR}") +ELSE (GSTREAMER_INCLUDE_DIR) + MESSAGE(STATUS "GStreamer: WARNING: include dir not found") +ENDIF (GSTREAMER_INCLUDE_DIR) + +IF (GSTREAMER_LIBRARIES) + #MESSAGE(STATUS "DEBUG: Found GStreamer library: ${GSTREAMER_LIBRARIES}") +ELSE (GSTREAMER_LIBRARIES) + MESSAGE(STATUS "GStreamer: WARNING: library not found") +ENDIF (GSTREAMER_LIBRARIES) + +IF (GSTREAMER_INTERFACE_LIBRARY) + #MESSAGE(STATUS "DEBUG: Found GStreamer interface library: ${GSTREAMER_INTERFACE_LIBRARY}") +ELSE (GSTREAMER_INTERFACE_LIBRARY) + MESSAGE(STATUS "GStreamer: WARNING: interface library not found") +ENDIF (GSTREAMER_INTERFACE_LIBRARY) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GStreamer DEFAULT_MSG GSTREAMER_LIBRARIES GSTREAMER_INCLUDE_DIR GSTREAMER_BASE_LIBRARY GSTREAMER_INTERFACE_LIBRARY) + +MARK_AS_ADVANCED(GSTREAMER_INCLUDE_DIR GSTREAMER_LIBRARIES GSTREAMER_BASE_LIBRARY GSTREAMER_INTERFACE_LIBRARY) diff --git a/cmake/modules/FindLibXml2.cmake b/cmake/modules/FindLibXml2.cmake new file mode 100644 index 0000000..353be55 --- /dev/null +++ b/cmake/modules/FindLibXml2.cmake @@ -0,0 +1,57 @@ +# - Try to find LibXml2 +# Once done this will define +# +# LIBXML2_FOUND - System has LibXml2 +# LIBXML2_INCLUDE_DIR - The LibXml2 include directory +# LIBXML2_LIBRARIES - The libraries needed to use LibXml2 +# LIBXML2_DEFINITIONS - Compiler switches required for using LibXml2 +# LIBXML2_XMLLINT_EXECUTABLE - The XML checking tool xmllint coming with LibXml2 + +# Copyright (c) 2006, Alexander Neundorf, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +IF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) + # in cache already + SET(LibXml2_FIND_QUIETLY TRUE) +ENDIF (LIBXML2_INCLUDE_DIR AND LIBXML2_LIBRARIES) + +IF (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + FIND_PACKAGE(PkgConfig) + PKG_CHECK_MODULES(PC_LIBXML libxml-2.0) + SET(LIBXML2_DEFINITIONS ${PC_LIBXML_CFLAGS_OTHER}) +ENDIF (NOT WIN32) + +FIND_PATH(LIBXML2_INCLUDE_DIR libxml/xpath.h + HINTS + ${PC_LIBXML_INCLUDEDIR} + ${PC_LIBXML_INCLUDE_DIRS} + PATH_SUFFIXES libxml2 + ) + +FIND_LIBRARY(LIBXML2_LIBRARIES NAMES xml2 libxml2 + HINTS + ${PC_LIBXML_LIBDIR} + ${PC_LIBXML_LIBRARY_DIRS} + ) + +FIND_PROGRAM(LIBXML2_XMLLINT_EXECUTABLE xmllint) +# for backwards compat. with KDE 4.0.x: +SET(XMLLINT_EXECUTABLE "${LIBXML2_XMLLINT_EXECUTABLE}") + +IF( NOT LIBXML2_XMLLINT_EXECUTABLE ) + MESSAGE(STATUS "xmllint program not found. Install it if you want validate generated doc file.") +ENDIF(NOT LIBXML2_XMLLINT_EXECUTABLE ) + + +INCLUDE(FindPackageHandleStandardArgs) + +# handle the QUIETLY and REQUIRED arguments and set LIBXML2_FOUND to TRUE if +# all listed variables are TRUE +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR) + +MARK_AS_ADVANCED(LIBXML2_INCLUDE_DIR LIBXML2_LIBRARIES LIBXML2_XMLLINT_EXECUTABLE) diff --git a/cmake/modules/FindTelepathyFarsight.cmake b/cmake/modules/FindTelepathyFarsight.cmake new file mode 100644 index 0000000..65215d6 --- /dev/null +++ b/cmake/modules/FindTelepathyFarsight.cmake @@ -0,0 +1,49 @@ +# - Try to find Telepathy-Farsight +# Once done this will define +# +# TELEPATHY_FARSIGHT_FOUND - system has TelepathyFarsight +# TELEPATHY_FARSIGHT_INCLUDE_DIR - the TelepathyFarsight include directory +# TELEPATHY_FARSIGHT_LIBRARIES - the libraries needed to use TelepathyFarsight +# TELEPATHY_FARSIGHT_DEFINITIONS - Compiler switches required for using TelepathyFarsight + +# Copyright (c) 2010, Dario Freddi +# +# Redistribution and use is allowed according to the terms of the BSD license. + +if (TELEPATHY_FARSIGHT_INCLUDE_DIR AND TELEPATHY_FARSIGHT_LIBRARIES) + # in cache already + set(TelepathyFarsight_FIND_QUIETLY TRUE) +else (TELEPATHY_FARSIGHT_INCLUDE_DIR AND TELEPATHY_FARSIGHT_LIBRARIES) + set(TelepathyFarsight_FIND_QUIETLY FALSE) +endif (TELEPATHY_FARSIGHT_INCLUDE_DIR AND TELEPATHY_FARSIGHT_LIBRARIES) + +if (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the find_path() and find_library() calls + find_package(PkgConfig) + if (TELEPATHY_FARSIGHT_MIN_VERSION) + PKG_CHECK_MODULES(PC_TELEPATHY_FARSIGHT telepathy-farsight>=${TELEPATHY_FARSIGHT_MIN_VERSION}) + else (TELEPATHY_FARSIGHT_MIN_VERSION) + PKG_CHECK_MODULES(PC_TELEPATHY_FARSIGHT telepathy-farsight) + endif (TELEPATHY_FARSIGHT_MIN_VERSION) + set(TELEPATHY_FARSIGHT_DEFINITIONS ${PC_TELEPATHY_FARSIGHT_CFLAGS_OTHER}) +endif (NOT WIN32) + +find_path(TELEPATHY_FARSIGHT_INCLUDE_DIR telepathy-farsight/channel.h + PATHS + ${PC_TELEPATHY_FARSIGHT_INCLUDEDIR} + ${PC_TELEPATHY_FARSIGHT_INCLUDE_DIRS} + PATH_SUFFIXES telepathy-1.0 + ) + +find_library(TELEPATHY_FARSIGHT_LIBRARIES NAMES telepathy-farsight + PATHS + ${PC_TELEPATHY_FARSIGHT_LIBDIR} + ${PC_TELEPATHY_FARSIGHT_LIBRARY_DIRS} + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TelepathyFarsight DEFAULT_MSG TELEPATHY_FARSIGHT_LIBRARIES + TELEPATHY_FARSIGHT_INCLUDE_DIR) + +mark_as_advanced(TELEPATHY_FARSIGHT_INCLUDE_DIR TELEPATHY_FARSIGHT_LIBRARIES) diff --git a/cmake/modules/FindTelepathyGlib.cmake b/cmake/modules/FindTelepathyGlib.cmake new file mode 100644 index 0000000..be03995 --- /dev/null +++ b/cmake/modules/FindTelepathyGlib.cmake @@ -0,0 +1,49 @@ +# - Try to find Telepathy-Glib +# Once done this will define +# +# TELEPATHY_GLIB_FOUND - system has Telepathy-Glib +# TELEPATHY_GLIB_INCLUDE_DIR - the Telepathy-Glib include directory +# TELEPATHY_GLIB_LIBRARIES - the libraries needed to use Telepathy-Glib +# TELEPATHY_GLIB_DEFINITIONS - Compiler switches required for using Telepathy-Glib + +# Copyright (c) 2010, Dario Freddi +# +# Redistribution and use is allowed according to the terms of the BSD license. + +if (TELEPATHY_GLIB_INCLUDE_DIR AND TELEPATHY_GLIB_LIBRARIES) + # in cache already + set(TELEPATHYGLIB_FIND_QUIETLY TRUE) +else (TELEPATHY_GLIB_INCLUDE_DIR AND TELEPATHY_GLIB_LIBRARIES) + set(TELEPATHYGLIB_FIND_QUIETLY FALSE) +endif (TELEPATHY_GLIB_INCLUDE_DIR AND TELEPATHY_GLIB_LIBRARIES) + +if (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the find_path() and find_library() calls + find_package(PkgConfig) + if (TELEPATHY_GLIB_MIN_VERSION) + PKG_CHECK_MODULES(PC_TELEPATHY_GLIB telepathy-glib>=${TELEPATHY_GLIB_MIN_VERSION}) + else (TELEPATHY_GLIB_MIN_VERSION) + PKG_CHECK_MODULES(PC_TELEPATHY_GLIB telepathy-glib) + endif (TELEPATHY_GLIB_MIN_VERSION) + set(TELEPATHY_GLIB_DEFINITIONS ${PC_TELEPATHY_GLIB_CFLAGS_OTHER}) +endif (NOT WIN32) + +find_path(TELEPATHY_GLIB_INCLUDE_DIR telepathy-glib/client.h + PATHS + ${PC_TELEPATHY_GLIB_INCLUDEDIR} + ${PC_TELEPATHY_GLIB_INCLUDE_DIRS} + PATH_SUFFIXES telepathy-1.0 + ) + +find_library(TELEPATHY_GLIB_LIBRARIES NAMES telepathy-glib + PATHS + ${PC_TELEPATHY_GLIB_LIBDIR} + ${PC_TELEPATHY_GLIB_LIBRARY_DIRS} + ) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(TelepathyGlib DEFAULT_MSG TELEPATHY_GLIB_LIBRARIES + TELEPATHY_GLIB_INCLUDE_DIR) + +mark_as_advanced(TELEPATHY_GLIB_INCLUDE_DIR TELEPATHY_GLIB_LIBRARIES) diff --git a/examples/call/CMakeLists.txt b/examples/call/CMakeLists.txt index 33d2435..35eb8ec 100644 --- a/examples/call/CMakeLists.txt +++ b/examples/call/CMakeLists.txt @@ -1,9 +1,13 @@ -if(TP_FARSIGHT_FOUND) +if(FARSIGHT_COMPONENTS_FOUND) include_directories( ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${QT_INCLUDES} - ${TP_FARSIGHT_INCLUDE_DIRS}) + ${TELEPATHY_FARSIGHT_INCLUDE_DIR} + ${GSTREAMER_INCLUDE_DIR} + ${GLIB2_INCLUDE_DIR} + ${LIBXML2_INCLUDE_DIR} + ${DBUS_INCLUDE_DIR}) set(call_SRCS main.cpp @@ -34,8 +38,7 @@ if(TP_FARSIGHT_FOUND) ${QT_QTCORE_LIBRARIES} ${QT_QTGUI_LIBRARIES} ${QT_QTCORE_LIBRARIES} - ${TP_FARSIGHT_LIBRARIES} telepathy-qt4 telepathy-qt4-farsight telepathy-qt4-examples-roster) -endif(TP_FARSIGHT_FOUND) +endif(FARSIGHT_COMPONENTS_FOUND) diff --git a/tests/dbus/CMakeLists.txt b/tests/dbus/CMakeLists.txt index f6a76b8..59109d9 100644 --- a/tests/dbus/CMakeLists.txt +++ b/tests/dbus/CMakeLists.txt @@ -23,7 +23,9 @@ if(HAVE_TEST_PYTHON) endif(HAVE_TEST_PYTHON) if(ENABLE_TP_GLIB_TESTS) - include_directories(${TPGLIB_INCLUDE_DIRS}) + include_directories(${TELEPATHY_GLIB_INCLUDE_DIR} + ${GLIB2_INCLUDE_DIR} + ${DBUS_INCLUDE_DIR}) if(HAVE_TEST_PYTHON) add_dbus_unit_test(AccountChannelDispatcher account-channel-dispatcher tp-glib-tests) diff --git a/tests/lib/glib/CMakeLists.txt b/tests/lib/glib/CMakeLists.txt index 64c742d..7eb5503 100644 --- a/tests/lib/glib/CMakeLists.txt +++ b/tests/lib/glib/CMakeLists.txt @@ -2,7 +2,9 @@ include_directories( ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} - ${TPGLIB_INCLUDE_DIRS}) + ${TELEPATHY_GLIB_INCLUDE_DIR} + ${GLIB2_INCLUDE_DIR} + ${DBUS_INCLUDE_DIR}) if(ENABLE_TP_GLIB_TESTS) add_subdirectory(callable) @@ -21,7 +23,7 @@ if(ENABLE_TP_GLIB_TESTS) simple-manager.c simple-manager.h) add_library(tp-glib-tests SHARED ${tp_glib_tests_SRCS}) - target_link_libraries(tp-glib-tests ${TPGLIB_LIBRARIES} + target_link_libraries(tp-glib-tests ${TELEPATHY_GLIB_LIBRARIES} example-cm-callable example-cm-contactlist example-cm-csh -- 1.7.0.6