From 9a71bc72c092d423cdc396f6dec924016f396562 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Tue, 14 Jun 2011 11:30:41 +0200 Subject: [PATCH] Use swiften-config to get libraries --- CMakeLists.txt | 1 + cmake_modules/SwiftenConfig.cmake | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9b67004d..342de95c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,6 +35,7 @@ find_package(Doxygen) INCLUDE(FindQt4) FIND_PACKAGE(Qt4 COMPONENTS QtCore) +# ADD_DEFINITIONS(${SWIFTEN_CFLAGS}) message(" Supported features") message("-----------------------") diff --git a/cmake_modules/SwiftenConfig.cmake b/cmake_modules/SwiftenConfig.cmake index e3737c09..ca806763 100644 --- a/cmake_modules/SwiftenConfig.cmake +++ b/cmake_modules/SwiftenConfig.cmake @@ -2,9 +2,22 @@ FIND_LIBRARY(SWIFTEN_LIBRARY NAMES Swiften) FIND_PATH(SWIFTEN_INCLUDE_DIR NAMES "Swiften.h" PATH_SUFFIXES libSwiften Swiften ) if( SWIFTEN_LIBRARY AND SWIFTEN_INCLUDE_DIR ) - set( SWIFTEN_INCLUDE_DIR ${SWIFTEN_INCLUDE_DIR}/.. ) - message( STATUS "Found libSwiften: ${SWIFTEN_LIBRARY}, ${SWIFTEN_INCLUDE_DIR}") - set( SWIFTEN_FOUND 1 ) + find_program(SWIFTEN_CONFIG_EXECUTABLE NAMES swiften-config DOC "swiften-config executable") + set( SWIFTEN_CFLAGS "" ) + if (SWIFTEN_CONFIG_EXECUTABLE) + execute_process( + COMMAND swiften-config --libs + OUTPUT_VARIABLE SWIFTEN_LIBRARY) + execute_process( + COMMAND swiften-config --cflags + OUTPUT_VARIABLE SWIFTEN_CFLAGS) + string(REGEX REPLACE "[\r\n]" " " SWIFTEN_LIBRARY "${SWIFTEN_LIBRARY}") + string(REGEX REPLACE " +$" "" SWIFTEN_LIBRARY "${SWIFTEN_LIBRARY}") + endif() + + set( SWIFTEN_INCLUDE_DIR ${SWIFTEN_INCLUDE_DIR}/.. ) + message( STATUS "Found libSwiften: ${SWIFTEN_LIBRARY}, ${SWIFTEN_INCLUDE_DIR}") + set( SWIFTEN_FOUND 1 ) else( SWIFTEN_LIBRARY AND SWIFTEN_INCLUDE_DIR ) message( FATAL_ERROR "Could NOT find libSwiften" ) endif( SWIFTEN_LIBRARY AND SWIFTEN_INCLUDE_DIR )