| 1 |
# Copyright (C) 2024 The Qt Company Ltd. |
| 2 |
# SPDX-License-Identifier: BSD-3-Clause |
| 3 |
|
| 4 |
cmake_minimum_required(VERSION 3.16) |
| 5 |
|
| 6 |
if(NOT DEFINITIONS) |
| 7 |
message(FATAL_ERROR "No definitions are provided to test") |
| 8 |
endif() |
| 9 |
|
| 10 |
if(NOT MOC_ARGS) |
| 11 |
message(FATAL_ERROR "The moc RSP file is not specified") |
| 12 |
endif() |
| 13 |
|
| 14 |
file(READ "${MOC_ARGS}" moc_args_data) |
| 15 |
|
| 16 |
string(REPLACE "\n" ";" moc_args_data "${moc_args_data}") |
| 17 |
|
| 18 |
foreach(def IN LISTS DEFINITIONS) |
| 19 |
set(found FALSE) |
| 20 |
foreach(data IN LISTS moc_args_data) |
| 21 |
if(data MATCHES "^(-D)?${def}") |
| 22 |
set(found TRUE) |
| 23 |
break() |
| 24 |
endif() |
| 25 |
endforeach() |
| 26 |
if(NOT found) |
| 27 |
message(FATAL_ERROR "The ${def} is missing in the moc argument list:\n${moc_args_data}") |
| 28 |
endif() |
| 29 |
endforeach() |
| 30 |
|