Warning, /frameworks/knewstuff/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 # SPDX-FileCopyrightText: KDE Contributors
0002 # SPDX-License-Identifier: BSD-2-Clause
0003
0004 include(ECMMarkAsTest)
0005 include(ECMMarkNonGuiExecutable)
0006 include(ECMAddTests)
0007
0008 find_package(Qt${QT_MAJOR_VERSION}Test ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED)
0009 set_package_properties(Qt${QT_MAJOR_VERSION}Test PROPERTIES
0010 TYPE REQUIRED
0011 PURPOSE "Required for unit tests")
0012
0013 # src also removes -DQT_NO_CAST_FROM_ASCII
0014 remove_definitions(-DQT_NO_CAST_FROM_ASCII)
0015 include_directories( ${CMAKE_CURRENT_BINARY_DIR}/../src ../src )
0016
0017 add_library(knewstuff_test_static STATIC
0018 ${CMAKE_BINARY_DIR}/src/knewstuff_debug.cpp
0019 ${CMAKE_BINARY_DIR}/src/core/knewstuffcore_debug.cpp)
0020 target_link_libraries(knewstuff_test_static PUBLIC Qt${QT_MAJOR_VERSION}::Xml Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Gui KF5::KIOCore KF5::NewStuffCore KF5::NewStuff)
0021 macro(knewstuff_unit_tests)
0022 foreach(_testmain ${ARGN})
0023 get_filename_component(_testname ${_testmain} NAME_WE)
0024 ecm_add_test(${_testmain}
0025 TEST_NAME ${_testname}
0026 NAME_PREFIX "knewstuff-")
0027 target_compile_definitions(${_testname} PUBLIC -DDATA_DIR="${CMAKE_CURRENT_BINARY_DIR}/data/")
0028 target_link_libraries(${_testname} knewstuff_test_static)
0029 endforeach()
0030 endmacro()
0031
0032 knewstuff_unit_tests(
0033 knewstuffentrytest.cpp
0034 )
0035
0036 # KMoreTools:
0037 ecm_add_test(kmoretools/kmoretoolstest.cpp ../src/knewstuff_debug.cpp
0038 LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test Qt${QT_MAJOR_VERSION}::Widgets KF5::NewStuffCore KF5::NewStuff KF5::I18n KF5::KIOGui
0039 TEST_NAME kmoretoolstest)
0040
0041 # ===========
0042
0043 add_executable(kmoretoolstest2 kmoretools/kmoretoolstest2.cpp ../src/knewstuff_debug.cpp)
0044 # The next line is commented out to prevent CI server to pick up those tests:
0045 # add_test(kmoretoolstest2 kmoretoolstest2) # uncomment to run tests locally
0046 ecm_mark_as_test(kmoretoolstest2)
0047 target_link_libraries(kmoretoolstest2 Qt${QT_MAJOR_VERSION}::Test KF5::NewStuff KF5::I18n KF5::KIOGui)
0048
0049 add_subdirectory(core)