diff options
Diffstat (limited to 'tests/auto/cmake/test_moc_macro_target/check_moc_parameters.cmake')
-rw-r--r-- | tests/auto/cmake/test_moc_macro_target/check_moc_parameters.cmake | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/cmake/test_moc_macro_target/check_moc_parameters.cmake b/tests/auto/cmake/test_moc_macro_target/check_moc_parameters.cmake new file mode 100644 index 0000000000..5388816c07 --- /dev/null +++ b/tests/auto/cmake/test_moc_macro_target/check_moc_parameters.cmake @@ -0,0 +1,17 @@ + +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: BSD-3-Clause +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}) |