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