project(muon)

set(CMAKE_MODULE_PATH "${muon_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})

set(KDE_MIN_VERSION "4.7.0")
find_package(KDE4 ${KDE_MIN_VERSION} REQUIRED)
find_package(QApt QUIET)
find_package(DebconfKDE QUIET)
find_package(QtOAuth REQUIRED)
find_package(QCA2 REQUIRED) #required by QtOAuth
find_package(QJSON REQUIRED)
find_package(LibAttica QUIET)
find_package(BODEGA QUIET)
find_package(AkabeiCore QUIET)
find_package(AkabeiClient QUIET)
find_package(PackageKitQt2 QUIET)

include(KDE4Defaults)
include(FindPkgConfig)

if(NOT qjson_LIBRARIES) #hack to compatibilize different qjson finder versions
    set(qjson_LIBRARIES ${QJSON_LIBRARIES})
endif()

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")

include_directories(${KDE4_INCLUDES} ${QT_INCLUDES} ${QAPT_INCLUDE_DIR}
                    ${CMAKE_CURRENT_BINARY_DIR} ${QCA2_INCLUDE_DIR}
                    ${QJSON_INCLUDE_DIR}
                    ${CMAKE_SOURCE_DIR}/libmuon ${CMAKE_BINARY_DIR}/libmuon)


set(MUON_VERSION "2.2.0")
configure_file(MuonVersion.h.in MuonVersion.h)

add_subdirectory(libmuon)
if(QAPT_FOUND)
    add_subdirectory(libmuonapt)
    add_subdirectory(muon)
    add_subdirectory(installer)
endif()
add_subdirectory(updater)
add_subdirectory(discover)
add_subdirectory(exporter)

macro_log_feature(QAPT_FOUND "LibQApt" "Qt wrapper around the libapt-pkg library"
                  "http://www.kde.org" FALSE "" "Required to build the APT backend")
macro_log_feature(LIBATTICA_FOUND "LibAttica" "Qt library that implements the Open Collaboration Services API"
                  "http://www.kde.org" FALSE "" "Required to build the KNewStuff3 backend")
macro_log_feature(BODEGA_FOUND "Bodega" "Library that exposes Bodega resources"
                  "http://www.kde.org" FALSE "" "Required to build the Bodega backend")
macro_log_feature(AKABEICLIENT_FOUND "Akabei" "Library that exposes Akabei resources"
                  "http://www.kde.org" FALSE "" "Required to build the Akabei backend")
macro_log_feature(PACKAGEKITQT2_FOUND "PackageKitQt2" "Library that exposes PackageKit resources"
                  "http://www.packagekit.org" FALSE "" "Required to build the PackageKit backend")

macro_display_feature_log()
find_package(Msgfmt REQUIRED)
find_package(Gettext REQUIRED)
add_subdirectory( po )
add_subdirectory( doc-translations )
