File: AddTest.cmake

package info (click to toggle)
rtrlib 0.8.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,636 kB
  • sloc: ansic: 9,862; perl: 5,146; makefile: 177; sh: 109
file content (31 lines) | stat: -rw-r--r-- 916 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
enable_testing()
include(CTest)

function (ADD_RTR_TEST _testName _testSource)
    add_executable(${_testName} ${_testSource})
    target_link_libraries(${_testName} ${ARGN})
    add_test(${_testName} ${CMAKE_CURRENT_BINARY_DIR}/${_testName})
endfunction (ADD_RTR_TEST)


function (ADD_RTR_UNIT_TEST _testName _testSource)
    add_rtr_test(${_testName} ${_testSource} ${ARGN})
    add_coverage(${_testName})
endfunction (ADD_RTR_UNIT_TEST)


function (WRAP_FUNCTIONS _testName)
    set(template " -Wl,--wrap=")
    set(linkopts "")
    foreach(f ${ARGN})
        string(CONCAT linkopts ${linkopts} ${template} ${f})
    endforeach()

    get_target_property(temp ${_testName} COMPILE_FLAGS)
    if (temp)
        string(CONCAT linkopts ${temp} ${linkopts})
    endif()
    set_target_properties(${_testName}
                      PROPERTIES
                      LINK_FLAGS ${linkopts})
endfunction (WRAP_FUNCTIONS)