aux_source_directory(. SOURCESCODE)
add_library(kydiskinfo SHARED ${SOURCESCODE})
set_target_properties(kydiskinfo PROPERTIES VERSION 3.0.0 SOVERSION 3)
add_executable(test-getdiskinfo test/getdiskinfo.c)
add_executable(test-getdisklist test/getdisklist.c)
find_library(UDEV_LIB udev)
find_library(DBUS_LIB dbus-1)
find_library(PARTED_LIB parted)
find_library(MOUNT_LIB mount)
find_library(FDISK_LIB fdisk)
find_library(JSONC_LIB json-c)
target_link_libraries(kydiskinfo blkid kylog pthread systemd kyconf hd ${JSONC_LIB} ${UDEV_LIB} ${PARTED_LIB} ${MOUNT_LIB} ${FDISK_LIB})
target_link_libraries(test-getdiskinfo kydiskinfo)
target_link_libraries(test-getdisklist kydiskinfo)
# target_link_libraries(test-getdiskinfo kydiskinfo blkid kylog pthread systemd kyconf ${UDEV_LIB})
# target_link_libraries(test-getdisklist kydiskinfo blkid kylog pthread systemd kyconf ${UDEV_LIB})
target_link_options(kydiskinfo PRIVATE "-Wl,-z,now")

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

# 安装库文件  
install(TARGETS kydiskinfo 
        DESTINATION ${CMAKE_INSTALL_LIBDIR})

# install(TARGETS kydiskinfo
#         DESTINATION lib/kysdk/kysdk-system)

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