summaryrefslogtreecommitdiffstats
path: root/tests/auto/cmake/test_moc_macro_target/check_moc_parameters.cmake
diff options
context:
space:
mode:
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.cmake15
1 files changed, 15 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..4ca8fab119
--- /dev/null
+++ b/tests/auto/cmake/test_moc_macro_target/check_moc_parameters.cmake
@@ -0,0 +1,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})