aux_source_directory(. SOURCESCODE)
include_directories(.)
find_library(GLIBC_LIB glib-2.0)
find_library(DBUS_LIB dbus-1)
find_library(DBUS_GLIB_LIB dbus-glib-1)
find_package(PkgConfig)
add_library(kysdk-accounts SHARED ${SOURCESCODE})
set_target_properties(kysdk-accounts PROPERTIES VERSION 3.0.0 SOVERSION 3)
add_executable(kyaccounts-test test/kyaccounts_test.c)
pkg_check_modules(PKGS REQUIRED polkit-gobject-1)
target_link_libraries(kysdk-accounts kylog polkit-gobject-1 libcjson.so ${GLIBC_LIB} ${DBUS_LIB} ${DBUS_GLIB_LIB})
target_link_libraries(kyaccounts-test kysdk-accounts)
target_link_options(kysdk-accounts PRIVATE "-Wl,-z,now")

# 包含 GNU 安装目录设置  
include(GNUInstallDirs)

# 安装库文件  
install(TARGETS kysdk-accounts
        DESTINATION ${CMAKE_INSTALL_LIBDIR})

install(FILES libkyaccounts.h
        DESTINATION include/kysdk/kysdk-system)

install(FILES org.kylin.kysdk.accounts.policy
    DESTINATION share/polkit-1/actions/)
