~aleteoryx/muditaos

muditaos/cmake/modules/ModuleUtils.cmake -rw-r--r-- 621 bytes
a405cad6Aleteoryx trim readme 7 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
macro(module_is_test_entity)
    if(${ENABLE_TESTS})
        if (NOT ${ARGV0} STREQUAL "")
            set(_NAME ${ARGV0})
        else()
            string(REGEX MATCH "module-\([^/]*\)" _NAME ${CMAKE_CURRENT_LIST_DIR})
            set(_NAME ${CMAKE_MATCH_1})
        endif()

        if(${_NAME} STREQUAL "")
            message(FATAL_ERROR "Can't determine module name to enable testing.")
        endif()

        add_test_entity(NAME ${_NAME})

        enable_entity_coverage(
            NAME
                ${_NAME}
            COVERAGE_PATH
                .*/module-${_NAME}/.*
        )
    endif()
endmacro()