#  Copyright (C) 2021 KeePassXC Team <team@keepassxc.org>
#  Copyright (C) 2026 ChiPass Team <contact@chipass.org>
#
#  This program is free software: you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation, either version 2 or (at your option)
#  version 3 of the License.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program.  If not, see <http://www.gnu.org/licenses/>.

add_library(ykcore EXCLUDE_FROM_ALL STATIC
  ykcore.c
  ykstatus.c
  ykcrc.c
)
target_include_directories(ykcore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if (FREEDESKTOP)
  target_sources(ykcore PRIVATE ykcore_libusb-1.0.c)
  target_link_libraries(ykcore PRIVATE PkgConfig::libusb)
elseif (APPLE)
  target_sources(ykcore PRIVATE ykcore_osx.c)
  target_link_libraries(ykcore PRIVATE $<LINK_LIBRARY:FRAMEWORK,IOKit>)
elseif (WIN32)
  target_sources(ykcore PRIVATE ykcore_windows.c)
  target_link_libraries(ykcore PRIVATE uuid setupapi hid)
endif()
