Warning, /frameworks/karchive/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.

0001 remove_definitions(-DQT_NO_CAST_FROM_ASCII)
0002 
0003 include(ECMAddTests)
0004 
0005 find_package(Qt6Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
0006 find_package(Qt6Network)
0007 
0008 if(NOT Qt6Test_FOUND)
0009     message(STATUS "Qt6Test not found, autotests will not be built.")
0010     return()
0011 endif()
0012 
0013 ecm_add_tests(
0014     karchivetest.cpp
0015     kfiltertest.cpp
0016     LINK_LIBRARIES KF6::Archive Qt6::Test
0017 )
0018 
0019 target_link_libraries(kfiltertest ZLIB::ZLIB)
0020 
0021 ########### klimitediodevicetest ###############
0022 
0023 ecm_add_test(
0024     klimitediodevicetest.cpp
0025     ../src/klimitediodevice.cpp
0026     TEST_NAME klimitediodevicetest
0027     LINK_LIBRARIES Qt6::Test
0028 )
0029 target_include_directories(klimitediodevicetest
0030     PRIVATE $<TARGET_PROPERTY:KF6Archive,INTERFACE_INCLUDE_DIRECTORIES>)
0031 
0032 ########## kcompressiondevicetest ##############
0033 if (Qt6Network_FOUND)
0034     ecm_add_test(
0035         kcompressiondevicetest.cpp
0036         LINK_LIBRARIES KF6::Archive Qt6::Test Qt6::Network
0037     )
0038 
0039     set(testDir $<TARGET_FILE_DIR:kcompressiondevicetest>)
0040     get_filename_component(topdir ${CMAKE_CURRENT_SOURCE_DIR}/.. ABSOLUTE)
0041 
0042     add_custom_command(TARGET kcompressiondevicetest POST_BUILD
0043         COMMAND ${CMAKE_COMMAND} -E tar czf
0044         ${testDir}/kcompressiondevice_test.tar.gz examples
0045         WORKING_DIRECTORY ${topdir})
0046     add_custom_command(TARGET kcompressiondevicetest POST_BUILD
0047         COMMAND ${CMAKE_COMMAND} -E tar cjf
0048         ${testDir}/kcompressiondevice_test.tar.bz2 examples
0049         WORKING_DIRECTORY ${topdir})
0050 
0051     if (LIBLZMA_FOUND)
0052         add_custom_command(TARGET kcompressiondevicetest POST_BUILD
0053             COMMAND ${CMAKE_COMMAND} -E tar cJf
0054             ${testDir}/kcompressiondevice_test.tar.xz examples
0055             WORKING_DIRECTORY ${topdir})
0056     endif()
0057 
0058     if (LibZstd_FOUND)
0059         # cmake doesn't support creating zstd files so run tar directly
0060         # which is a bit annoying since not all tars support zstd either
0061         # so we first check that the installed tar has the --zstd
0062         # option and then we check that the zstd binary is available
0063 
0064         execute_process(COMMAND tar --help OUTPUT_VARIABLE TAR_OUTPUT)
0065         if (TAR_OUTPUT MATCHES ".*--zstd.*")
0066             find_program(ZSTD_FOUND zstd)
0067             if (ZSTD_FOUND)
0068                 add_custom_command(TARGET kcompressiondevicetest POST_BUILD
0069                     COMMAND tar --zstd -cf
0070                     ${testDir}/kcompressiondevice_test.tar.zst examples
0071                     WORKING_DIRECTORY ${topdir})
0072 
0073                 target_compile_definitions(kcompressiondevicetest PRIVATE HAVE_ZSTD_SUPPORT_FILE)
0074             endif()
0075         endif()
0076     endif()
0077 endif()