project(QtTelepathy)
cmake_minimum_required(VERSION 2.4.5)

# Set install locations:
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
set(EXEC_INSTALL_PREFIX  ${CMAKE_INSTALL_PREFIX}       CACHE PATH  "Base directory for executables and libraries" FORCE)
set(LIB_INSTALL_DIR          "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}"     CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)

find_package(Qt4 REQUIRED)
include(UsePkgConfig)

pkgconfig(dbus-1 DBUS_INC_DIR DBUS_LIB_DIR DBUS_LDFLAGS DBUS_CFLAGS)
pkgconfig(QtDBus QDBUS_INC_DIR QDBUS_LIB_DIR QDBUS_LDFLAGS QDBUS_CFLAGS)

find_library(QDBUS_LIBRARIES NAMES QtDBus
    PATHS ${DBUS_LIB_DIR}
    PATHS ${QDBUS_LIB_DIR}
)

SET(VERSION "0.17.7")
SET(SO_VERSION "1707")

# put the include dirs which are in the source or build tree
# before all other include dirs, so the headers in the sources
# are prefered over the already installed ones
# since cmake 2.4.1
set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)

if(NOT WIN32)
# Generate pkg-config file
configure_file(${CMAKE_SOURCE_DIR}/QtTelepathyClient.pc.in
               ${CMAKE_BINARY_DIR}/QtTelepathyClient.pc)

install(FILES ${CMAKE_BINARY_DIR}/QtTelepathyClient.pc
        DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
endif(NOT WIN32)

add_subdirectory(src/Client)
add_subdirectory(include/QtTelepathy/Client)

# install the common headers.
# Do not add the Common/src directory: That
# code is already build with Client and Core.
add_subdirectory(include/QtTelepathy/Common)

