# project
cmake_minimum_required(VERSION 3.15.0)
project(ani2xcursor LANGUAGES CXX)
include(GNUInstallDirs)
# target
add_executable(ani2xcursor  src/main.cpp)
install(TARGETS ani2xcursor RUNTIME)
set_target_properties(ani2xcursor PROPERTIES OUTPUT_NAME "ani2xcursor")
target_include_directories(ani2xcursor PRIVATE
    include
)
find_package(spdlog CONFIG REQUIRED)
cmake_pkg_config(IMPORT stb REQUIRED)
cmake_pkg_config(IMPORT xcursor REQUIRED)
target_link_libraries(ani2xcursor PRIVATE
    pthread
    spdlog::spdlog
    PkgConfig::stb
    PkgConfig::xcursor
    )
target_include_directories(ani2xcursor SYSTEM PRIVATE
    spdlog::spdlog
    PkgConfig::stb
    PkgConfig::xcursor
)
target_compile_features(ani2xcursor PRIVATE cxx_std_20)
# private sourcefiles from sourcebatch c++.build for target ani2xcursor
file(GLOB CPPFILE "${CMAKE_SOURCE_DIR}/src/*.cpp")

target_sources(ani2xcursor PRIVATE
${CPPFILE}
)

# target
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_executable(ani2xcursor_test "")
set_target_properties(ani2xcursor_test PROPERTIES OUTPUT_NAME "ani2xcursor_test")
target_include_directories(ani2xcursor_test PRIVATE
    include
)
target_include_directories(ani2xcursor_test SYSTEM PRIVATE
    spdlog::spdlog
    PkgConfig::stb
)
set_target_properties(ani2xcursor_test PROPERTIES CXX_EXTENSIONS OFF)
target_compile_features(ani2xcursor_test PRIVATE cxx_std_20)

target_link_libraries(ani2xcursor_test PRIVATE
    pthread
    spdlog::spdlog

)
# private sourcefiles from sourcebatch c++.build for target ani2xcursor_test
target_sources(ani2xcursor_test PRIVATE 
    tests/test_inf_parser.cpp
${CPPFILE}
)
endif()
find_package(Gettext REQUIRED)
file(GLOB PO_FILES "${CMAKE_SOURCE_DIR}/locale/*.po")
gettext_create_translations(locale/ani2xcursor.pot
    ALL
    ${PO_FILES}
)
install(
    FILES "${CMAKE_SOURCE_DIR}/completions/bash/${CMAKE_PROJECT_NAME}"
    DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/bash-completion/completions"
    RENAME "${CMAKE_PROJECT_NAME}"
)

install(
    FILES "${CMAKE_SOURCE_DIR}/completions/zsh/_${CMAKE_PROJECT_NAME}"
    DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/zsh/site-functions"
    RENAME "_${CMAKE_PROJECT_NAME}"
)
install(
    FILES "${CMAKE_SOURCE_DIR}/completions/fish/${CMAKE_PROJECT_NAME}.fish"
    DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/fish/vendor_completions.d"
    RENAME "${CMAKE_PROJECT_NAME}.fish"
)
