# Populate a CMake variable with the sources
set(ukui-session_SRCS
    main.cpp
    sessionapplication.cpp
    modulemanager.cpp
    ukuimodule.cpp
    idlewatcher.cpp
    sessiondbusadaptor.h
    idlewatcher.cpp
    idlewatcher.h
    idleadbusdaptor.h
    xdgautostart.cpp
    xdgautostart.h
    xdgdesktopfile.cpp
    xdgdesktopfile.h
    xdgdirs.cpp
    xdgdirs.h
    xdgmacros.h
    usminhibit.cpp
    usminhibit.h
    ../tools/ukuipower.cpp
    ../tools/powerprovider.cpp
    ukuisessiondebug.cpp
    ukuisessiondebug.h
    sessionmanagercontext.h
    sessionmanagercontext.cpp
    ukuilockinfo.cpp
)

#find_package(QT5XDG )
find_package(PkgConfig)
pkg_search_module(GSETTINGS_QT REQUIRED gsettings-qt)
include_directories(${GSETTINGS_QT_INCLUDES})

pkg_check_modules(GLIB2 REQUIRED glib-2.0)
pkg_check_modules(GIO2 REQUIRED gio-2.0)

pkg_search_module(X11 REQUIRED x11)
pkg_check_modules(KDKINFO kysdk-sysinfo)
if (KDKINFO_FOUND)
    ADD_DEFINITIONS(-DKDKINFO_FOUND="true")
endif()

include_directories(${X11_INCLUDES})
include_directories(${GLIB2_INCLUDE_DIRS})
include_directories(${GIO2_INCLUDE_DIRS})
include_directories(${KDKINFO_INCLUDE_DIRS})

link_directories(${KDKINFO_LIBRARY_DIRS})

add_executable(ukui-session ${ukui-session_SRCS})
target_link_libraries(ukui-session
    Qt5::Widgets
    Qt5::Core
    Qt5::DBus
    Qt5::Multimedia
    KF5::IdleTime
    KF5::CoreAddons
    KF5::ConfigCore
    KF5::ConfigGui
    KF5::WindowSystem
    -lSM -lICE
    ${GSETTINGS_QT_LIBRARIES} ${X11_LIBRARIES}
    ${GLIB2_LIBRARIES}
    ${GIO2_LIBRARIES}
    ${KDKINFO_LIBRARIES})
#${GSETTINGS_QT_LIBRARIES}

install(TARGETS ukui-session DESTINATION bin)
