#
# CMake Script
# $Id$
# $HeadURL$
# $Author$
#

# BZip2 stub - libbz2-dev not available, disable bzip2 support
SET(HAVE_BZIP2 FALSE)
MESSAGE(STATUS "BZip2 disabled - development headers not available")

SET(nglcomp_SRCS
  nglcomp_bzip2iodevice.cpp
  nglcomp_bzip2iodevice.h
  nglcomp_compress.cpp
  nglcomp_compress.h
  nglcomp_export.h
  nglcomp_tarfilter.cpp
  nglcomp_tarfilter.h
)
NGL_ADD_LIBRARY2(WS nglcompression SHARED ${nglcomp_SRCS})
NGL_TARGET_LINK_LIBRARIES(nglcompression
  PUBLIC
    Qt6::Core
  PRIVATE
    Qt6::Concurrent
    NGLLogger
)
# BZip2 disabled - no linking needed
NGL_INSTALL_TARGET(nglcompression)

IF(BUILD_WS AND BUILD_TESTING)
  REMOVE_DEFINITIONS(-DQT_GUI_LIB)
  ADD_EXECUTABLE(nglcomp_test nglcomp_test.cpp nglcomp_test.h)

  TARGET_LINK_LIBRARIES(nglcomp_test
      NGLLogger
      nglcoreapplication
      ngltools
      nglcompression
      Qt6::Test
      )

  ADD_TEST(NAME nglcomp_test COMMAND $<TARGET_FILE:nglcomp_test>)
ENDIF()
