Warning, /pim/zanshin/tests/testlib/MacroAkonadiAutoTests.cmake is written in an unsupported language. File is not indexed.

0001 set(_akonaditest_source_dir ${CMAKE_CURRENT_LIST_DIR})
0002 
0003 MACRO(ZANSHIN_AKONADI_AUTO_TESTS)
0004   set(prefix "${CMAKE_CURRENT_SOURCE_DIR}")
0005   string(REPLACE "${CMAKE_SOURCE_DIR}" "" prefix "${prefix}")
0006   string(REPLACE "/" "-" prefix "${prefix}")
0007   string(REPLACE "\\" "-" prefix "${prefix}")
0008   string(LENGTH "${prefix}" prefix_length)
0009   string(SUBSTRING "${prefix}" 1 ${prefix_length}-1 prefix)
0010 
0011   FOREACH(_testname ${ARGN})
0012     set(_prefixed_testname "${prefix}-${_testname}")
0013     add_executable(${_prefixed_testname} ${_testname}.cpp)
0014     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${KDE4_ENABLE_EXCEPTIONS}")
0015     target_link_libraries(${_prefixed_testname} Qt::Test akonadi domain utils)
0016 
0017     set(_location "${CMAKE_CURRENT_BINARY_DIR}/${_prefixed_testname}")
0018     if (WIN32)
0019       set(_executable "${_location}.exe")
0020     else (WIN32)
0021       set(_executable "${_location}")
0022     endif (WIN32)
0023 
0024     find_program(_testrunner akonaditest)
0025 
0026     set(AKONADITEST_CWD "${CMAKE_CURRENT_SOURCE_DIR}")
0027     set(zanshin-testcommand "${_executable}")
0028     configure_file(${_akonaditest_source_dir}/akonaditest-run.sh.in ${_prefixed_testname}-run.sh)
0029 
0030     set(akonaditest-run-cmd "${_testrunner}" -c "${CMAKE_CURRENT_SOURCE_DIR}/testenv/config.xml"
0031                             sh "${CMAKE_CURRENT_BINARY_DIR}/${_prefixed_testname}-run.sh")
0032 
0033     add_custom_target(${_prefixed_testname}-run
0034                       COMMAND ${akonaditest-run-cmd}
0035                       WORKING_DIRECTORY ${AKONADITEST_CWD}
0036                       USES_TERMINAL
0037     )
0038 
0039     add_test(NAME ${_prefixed_testname} COMMAND ${CMAKE_MAKE_PROGRAM} -C "${CMAKE_BINARY_DIR}" ${_prefixed_testname}-run)
0040   ENDFOREACH(_testname)
0041 ENDMACRO(ZANSHIN_AKONADI_AUTO_TESTS)