project(polkit-kde-1)

set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

find_package(KDE4 REQUIRED)
include (KDE4Defaults)
include (MacroLibrary)
include (FindPkgConfig)

function(dbus_add_activation_system_service _sources)
    pkg_search_module( DBUS dbus-1 )
    foreach (_i ${_sources})
        get_filename_component(_service_file ${_i} ABSOLUTE)
        string(REGEX REPLACE "\\.service.*$" ".service" _output_file ${_i})
        set(_target ${CMAKE_CURRENT_BINARY_DIR}/${_output_file})
        configure_file(${_service_file} ${_target})
        install(FILES ${_target} DESTINATION ${DBUS_SYSTEM_SERVICES_INSTALL_DIR} )
    endforeach (_i ${ARGN})
endfunction(dbus_add_activation_system_service _sources)

find_package(PolkitQt-1 REQUIRED)

include_directories(${KDE4_INCLUDES}
                    ${POLKITQT-1_INCLUDE_DIR})

macro_optional_add_subdirectory(agent)

option(BUILD_KCMODULES "Builds kcmodules for polkit-qt-1 - currently in experimental and non working state" OFF)
if (BUILD_KCMODULES)
    message(STATUS "BUILDING KCMODULES --- WARNING!!! This is nothing but a technical preview. And don't say I didn't warn you.")
    macro_optional_add_subdirectory(kcmodules)
endif (BUILD_KCMODULES)

