summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/test_moc_macro_target/check_moc_parameters.cmake
blob: 4ca8fab11937e819f67f82b295c312c2a20770ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

function(check_parameters file_path)
    file(READ ${file_path} file_content)
    foreach(compile_option IN ITEMS "-DDEFINE_CMDLINE_SIGNAL" "-DMY_OPTION")
        string(REGEX MATCHALL "${compile_option}" matches ${file_content})
        list(LENGTH matches matches_length)
        if(matches_length GREATER 1)
            message(FATAL_ERROR "${compile_option} is defined multiple times in ${file_path}")
        elseif(matches_length EQUAL 0)
            message(FATAL_ERROR "${compile_option} is not defined in ${file_path}")
        endif()
    endforeach()
endfunction()

check_parameters(${PARAMETERS_FILE_PATH})