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

0001 
0002 find_package(Qt${QT_MAJOR_VERSION}Test ${REQUIRED_QT_VERSION} CONFIG QUIET)
0003 
0004 if(NOT TARGET Qt${QT_MAJOR_VERSION}::Test)
0005     message(STATUS "Qt${QT_MAJOR_VERSION}Test not found, autotests will not be built.")
0006     return()
0007 endif()
0008 
0009 qt_add_dbus_adaptor(kauth_dbus_adaptor_tests_SRCS
0010                      ../src/backends/dbus/org.kde.kf5auth.xml
0011                      ../src/backends/dbus/DBusHelperProxy.h
0012                      KAuth::DBusHelperProxy)
0013 
0014 include(ECMAddTests)
0015 
0016 set(kauthdebug_SRCS)
0017 ecm_qt_declare_logging_category(kauthdebug_tests_SRCS
0018     HEADER kauthdebug.h
0019     IDENTIFIER KAUTH
0020     CATEGORY_NAME kf.auth
0021 )
0022 
0023 
0024 set(libkauth_tests_static_SRCS
0025     ../src/action.cpp
0026     ../src/actionreply.cpp
0027     ../src/executejob.cpp
0028     ../src/AuthBackend.cpp
0029     # Use our "special" backends manager
0030     BackendsManager.cpp
0031     ../src/HelperProxy.cpp
0032     ../src/helpersupport.cpp
0033     TestBackend.cpp
0034     ../src/backends/dbus/DBusHelperProxy.cpp
0035     ${kauth_dbus_adaptor_tests_SRCS}
0036     ${kauthdebug_tests_SRCS}
0037 )
0038 
0039 add_library(kauth_tests_static STATIC ${libkauth_tests_static_SRCS})
0040 # make sure all executables using this library have the define set to make sure it builds on MSVC
0041 target_compile_definitions(kauth_tests_static
0042     PUBLIC KAUTHCORE_STATIC_DEFINE=1
0043     PUBLIC KAUTH_STATIC_DEFINE=1
0044 )
0045 # have to manually duplicate logic of flags set by ecm_generate_expoirt_header on the library
0046 ecm_export_header_format_version(${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
0047     CURRENT_VERSION ${KF_VERSION}
0048     HEXNUMBER_VAR kauthcore_tests_no_deprecated_before_and_at
0049 )
0050 target_compile_definitions(kauth_tests_static
0051     PUBLIC "KAUTHCORE_DISABLE_DEPRECATED_BEFORE_AND_AT=${kauthcore_tests_no_deprecated_before_and_at}"
0052     PUBLIC "KAUTHCORE_DEPRECATED_WARNINGS_SINCE=${kauthcore_tests_no_deprecated_before_and_at}"
0053 )
0054 ecm_mark_as_test(kauth_tests_static)
0055 
0056 target_include_directories(kauth_tests_static
0057   PUBLIC
0058     $<TARGET_PROPERTY:KF5::AuthCore,INTERFACE_INCLUDE_DIRECTORIES>
0059     ${CMAKE_CURRENT_SOURCE_DIR}/../src
0060 )
0061 
0062 target_link_libraries(kauth_tests_static PUBLIC Qt${QT_MAJOR_VERSION}::DBus KF5::CoreAddons)
0063 
0064 ########### next target ###############
0065 
0066 ecm_add_test(SetupActionTest.cpp
0067     TEST_NAME KAuthSetupActionTest
0068     LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test kauth_tests_static
0069 )
0070 
0071 ########### next target ###############
0072 
0073 ecm_add_test(HelperTest.cpp TestHelper.cpp
0074     TEST_NAME KAuthHelperTest
0075     LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test kauth_tests_static
0076 )
0077 
0078 ########### test kauth-policy-gen ###############
0079 if(NOT "${KAUTH_BACKEND_NAME}" STREQUAL "FAKE")
0080     add_test(NAME KAuthPolicyGenTest
0081              COMMAND kauth-policy-gen ${CMAKE_SOURCE_DIR}/autotests/foo_actions.actions
0082                                       ${CMAKE_BINARY_DIR}/generated-foo.policy)
0083     add_test(KAuthPolicyGenTestCompare ${CMAKE_COMMAND} -E compare_files
0084              ${CMAKE_BINARY_DIR}/generated-foo.policy ${CMAKE_SOURCE_DIR}/autotests/foo.policy)
0085     set_tests_properties(KAuthPolicyGenTestCompare PROPERTIES DEPENDS KAuthPolicyGenTest)
0086 endif()
0087