find_package(PkgConfig REQUIRED)
pkg_check_modules(UDEV REQUIRED libudev)
include_directories(${UDEV_INCLUDE_DIRS})

add_library(kydevicemanager SHARED libkydevicemanager.c)
set_target_properties(kydevicemanager PROPERTIES VERSION 3.0.0 SOVERSION 3)
target_link_libraries(kydevicemanager kylog ${UDEV_LIBRARIES})

add_executable(kydevicemanager-test test/kydevicemanager-test.c)
message(${LIBRARY_OUTPUT_PATH})
target_link_directories(kydevicemanager-test PRIVATE ${LIBRARY_OUTPUT_PATH})
target_link_libraries(kydevicemanager-test kydevicemanager)

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

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

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