PROJECT(Decibel)
CMAKE_MINIMUM_REQUIRED(VERSION 2.4.3)

SET(VERSION "0.3.0")
SET(SO_VERSION "1")

# Suffix for x86/x86_64:
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )

set(BIN_INSTALL_DIR
    "bin"
    CACHE PATH "The subdirectory relative to the install prefix for executables (default is bin)"
    FORCE
)

set(LIB_INSTALL_DIR
    "lib${LIB_SUFFIX}"
    CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is lib${LIB_SUFFIX})."
    FORCE
)

set(DATA_INSTALL_DIR
    "share"
    CACHE PATH "The subdirectory relative to the install prefix where shared data will be installed (default is share)."
    FORCE
)

set(COMPONENT_SEARCH_DIR
    "${DATA_INSTALL_DIR}/Decibel/components"
    CACHE PATH "The subdirectory relative to the install prefix where Decibel will look for its components (default is ${DATA_INSTALL_DIR}/Decibel/components)."
    FORCE
)

set(DBUS_SERVICES_INSTALL_DIR
    "${DATA_INSTALL_DIR}/dbus-1/services"
    CACHE PATH "D-Bus services directory (default is ${DATA_INSTALL_DIR}/dbus-1/services)."
    FORCE
)

set(DOC_INSTALL_DIR
    "${DATA_INSTALL_DIR}/doc/Decibel"
    CACHE PATH "The subdirectory relative to the install prefix for documentation files (default is ${DATA_INSTALL_DIR}/doc/Decibel)."
    FORCE
)

set(INCLUDE_INSTALL_DIR
    "include/Decibel"
    CACHE PATH "The subdirectory relative to the install prefix for header files (default is include/Decibel)."
    FORCE
)

set(DEMO_INSTALL_DIR
    "${LIB_INSTALL_DIR}/Decibel"
    CACHE PATH "The subdirectory relative to the install prefix for the demos (default is ${LIB_INSTALL_DIR}/Decibel)."
    FORCE
)

SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)

FIND_PACKAGE(Qt4 REQUIRED)
INCLUDE(UsePkgConfig REQUIRED)

PKGCONFIG(QtTapioca
          QTTAPIOCA_INC_DIR
          QTTAPIOCA_LIB_DIR
          QTTAPIOCA_LDFLAGS
          QTTAPIOCA_CFLAGS
)
FIND_LIBRARY(QTTAPIOCA_LIBRARIES NAMES QtTapioca
    PATHS ${QTTAPIOCA_LIB_DIR}
)

SET(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)

CONFIGURE_FILE("${CMAKE_SOURCE_DIR}/Doxyfile.cmake"
               "${CMAKE_BINARY_DIR}/Doxyfile"
)

CONFIGURE_FILE(
    "${CMAKE_SOURCE_DIR}/cmake/modules/cmake_uninstall.cmake.in"
    "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
    IMMEDIATE @ONLY
)

ADD_CUSTOM_TARGET(uninstall
    "${CMAKE_COMMAND}" -P "${CMAKE_BINARY_DIR}/cmake_uninstall.cmake"
)

ADD_SUBDIRECTORY(include)
ADD_SUBDIRECTORY(src)
ADD_SUBDIRECTORY(docs)

SET(LIBDECIBEL "-L${CMAKE_BINARY_DIR}/src/client/Decibel -ldecibel")

ENABLE_TESTING()
ADD_SUBDIRECTORY(tests)

ADD_SUBDIRECTORY(demos)

