find_package(PkgConfig REQUIRED)
pkg_check_modules(MAGICKWAND REQUIRED MagickWand)
include_directories(${MAGICKWAND_INCLUDE_DIRS})

add_library(kysearch SHARED libkysearch.c)
set_target_properties(kysearch PROPERTIES VERSION 3.0.0 SOVERSION 3)
target_link_libraries(kysearch kylog magic sqlite3 ${MAGICKWAND_LIBRARIES})
target_link_options(kysearch PRIVATE "-Wl,-z,now")

target_compile_definitions(kysearch PRIVATE
    MAGICKCORE_HDRI_ENABLE=1
    MAGICKCORE_QUANTUM_DEPTH=16
)

add_executable(kysearch-test test/kysearch-test.c)
target_link_libraries(kysearch-test kysearch)

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

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

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