Warning, /office/kexi/cmake/modules/MacroKexiAddTest.cmake is written in an unsupported language. File is not indexed.
0001 #
0002 # Copyright (c) 2012-2015 Jarosław Staniek <staniek@kde.org>
0003 #
0004 # Redistribution and use is allowed according to the terms of the BSD license.
0005 # For details see the accompanying COPYING-CMAKE-SCRIPTS file.
0006 #
0007 # Adds a single test with proper prefix.
0008 # Prefixes help to select subsets of tests to run, e.g. only Words tests or Flake tests.
0009 #
0010 # Usage: kexi_add_test(<prefix> <test_basename> <libraries_to_link>)
0011 #
0012 # Result: adds a test named "<prefix>-<test_basename>", with executable "<test_basename>"
0013 # and links it with libraries listed in <libraries_to_link>.
0014 #
0015 # Example: kexi_add_test(kexi GlobalSearchTest keximain kexicore kexiextendedwidgets)
0016 # -- adds a "kexi-GlobalSearchTest" test with executable GlobalSearchTest and links it with
0017 # libraries keximain, kexicore, kexiextendedwidgets.
0018 #
0019
0020 macro(kexi_add_test __test_prefix __test_basename)
0021 set(_args "")
0022 list(APPEND _libs ${ARGV})
0023 list(REMOVE_AT _libs 0 1)
0024
0025 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR})
0026 add_executable(${__test_basename} ${__test_basename}.cpp)
0027 add_test(${__test_prefix}-${__test_basename} ${__test_basename})
0028 ecm_mark_as_test(${__test_prefix}-${__test_basename})
0029 target_link_libraries(${__test_basename} Qt5::Test ${_libs})
0030 get_property(_COMPILE_FLAGS TARGET ${__test_basename} PROPERTY COMPILE_FLAGS)
0031 set_property(TARGET ${__test_basename} PROPERTY COMPILE_FLAGS
0032 ${_COMPILE_FLAGS}\ -DCURRENT_SOURCE_DIR="\\"${CMAKE_CURRENT_SOURCE_DIR}/\\""\ -DFILES_OUTPUT_DIR="\\"${CMAKE_CURRENT_BINARY_DIR}/\\"")
0033 #if (BUILD_TEST_COVERAGE)
0034 # target_link_libraries(${_test_name} gcov)
0035 #endif ()
0036 endmacro()