Warning, /frameworks/kconfig/autotests/CMakeLists.txt is written in an unsupported language. File is not indexed.
0001 include(ECMAddTests)
0002
0003 find_package(Qt6Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
0004 find_package(Qt6Concurrent ${REQUIRED_QT_VERSION} CONFIG QUIET)
0005
0006 if(NOT Qt6Test_FOUND)
0007 message(STATUS "Qt6Test not found, autotests will not be built.")
0008 return()
0009 endif()
0010
0011 if(NOT Qt6Concurrent_FOUND)
0012 message(STATUS "Qt6Concurrent not found, autotests will not be built.")
0013 return()
0014 endif()
0015
0016 # compile KEntryMap into the test since it's not exported
0017 ecm_add_test(
0018 kentrymaptest.cpp
0019 ../src/core/kconfigdata.cpp
0020 TEST_NAME kentrymaptest
0021 LINK_LIBRARIES Qt6::Test
0022 )
0023 target_include_directories(kentrymaptest PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../src/core)
0024
0025 qt_add_resources(sharedconfigresources sharedconfigresources.qrc)
0026
0027 ecm_add_test(ksharedconfigtest.cpp ${sharedconfigresources} TEST_NAME kconfigcore-ksharedconfigtest LINK_LIBRARIES KF6::ConfigCore Qt6::Test Qt6::Concurrent)
0028
0029 # test for fallback to :/kconfig/xxxx config resource
0030 qt_add_resources(fallbackconfigresources fallbackconfigresources.qrc)
0031 ecm_add_test(fallbackconfigresourcestest.cpp ${fallbackconfigresources} TEST_NAME kconfigcore-fallbackconfigresourcestest LINK_LIBRARIES KF6::ConfigCore Qt6::Test Qt6::Concurrent)
0032
0033 ecm_add_tests(
0034 kconfignokdehometest.cpp
0035 kconfigtest.cpp
0036 kdesktopfiletest.cpp
0037 test_kconf_update.cpp
0038 ksharedconfig_in_global_object.cpp
0039 dbussanitizertest.cpp
0040 NAME_PREFIX kconfigcore-
0041 LINK_LIBRARIES KF6::ConfigCore Qt6::Test Qt6::Concurrent
0042 )
0043
0044 add_dependencies(test_kconf_update kconf_update)
0045
0046 if(TARGET Qt6::Gui)
0047 ecm_add_tests(
0048 kconfigguitest.cpp
0049 kconfigloadertest.cpp
0050 kconfigskeletontest.cpp
0051 kstandardshortcuttest.cpp
0052 NAME_PREFIX kconfiggui-
0053 LINK_LIBRARIES KF6::ConfigGui Qt6::Test
0054 )
0055
0056 ecm_add_test(
0057 kstandardshortcutwatchertest.cpp
0058 # add sources instead of linking so we can use the unexported initialize()
0059 ../src/gui/kstandardshortcut.cpp
0060 ../src/gui/kstandardshortcutwatcher.cpp
0061 LINK_LIBRARIES KF6::ConfigCore Qt6::Gui Qt6::Test
0062 TEST_NAME kstandardshortcutwatchertest
0063 NAME_PREFIX kconfiggui-
0064 )
0065 target_include_directories(kstandardshortcutwatchertest PRIVATE "$<TARGET_PROPERTY:KF6ConfigGui,INTERFACE_INCLUDE_DIRECTORIES>")
0066 target_compile_definitions(kstandardshortcutwatchertest PRIVATE "-DKCONFIGGUI_STATIC_DEFINE")
0067
0068 # These tests do a global cleanup of ~/.qttest, so they can't run in parallel
0069 set_tests_properties(kconfigcore-kconfigtest PROPERTIES RUN_SERIAL TRUE)
0070 set_tests_properties(kconfigcore-kconfignokdehometest PROPERTIES RUN_SERIAL TRUE)
0071 set_tests_properties(kconfiggui-kconfigguitest PROPERTIES RUN_SERIAL TRUE)
0072
0073 if(NOT CMAKE_CROSSCOMPILING)
0074 add_subdirectory(kconfig_compiler)
0075 endif()
0076 endif()
0077
0078 find_package(Qt6 OPTIONAL_COMPONENTS Widgets)
0079 if(TARGET Qt6::Widgets)
0080 ecm_add_test(kwindowstatesavertest.cpp LINK_LIBRARIES KF6::ConfigGui Qt6::Test Qt6::Widgets)
0081 endif()
0082
0083 # benchmarks, don't execute during normal testing
0084 # they don't test additional stuff
0085 add_executable(kconfig_benchmark kconfig_benchmark.cpp)
0086 ecm_mark_nongui_executable(kconfig_benchmark)
0087 add_test(NAME kconfig_benchmark COMMAND kconfig_benchmark CONFIGURATIONS BENCHMARK)
0088 target_link_libraries(kconfig_benchmark KF6::ConfigCore Qt6::Test)