Debian Codegraph @

cmake/tribits/core/package_arch/TribitsReportInvalidTribitsUsage.cmake

raw
1 # @HEADER
2 # *****************************************************************************
3 # TriBITS: Tribal Build, Integrate, and Test System
4 #
5 # Copyright 2013-2016 NTESS and the TriBITS contributors.
6 # SPDX-License-Identifier: BSD-3-Clause
7 # *****************************************************************************
8 # @HEADER
9
10 include_guard()
11
12 include(MessageWrapper)
13
14 # Called to report incorrect usage
15 #
16 # Usage:
17 #
18 # tribits_report_invalid_tribits_usage("<err_msg0>" "<err_msg1>" ...)
19 #
20 # Depending on the value of ${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE, this
21 # function will:
22 #
23 # * FATAL_ERROR: Calls message(FATAL_ERROR "<error_message>")
24 # * SEND_ERROR: Calls message(SEND_ERROR "<error_message>")
25 # * WARNING: Calls message(WARNING "<error_message>")
26 # * NOTICE: Calls message(NOTICE "<error_message>")
27 # * IGNORE: Does not call message() at all and is silent
28 #
29 # If '${${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE}' is empty on call, then
30 # `FATAL_ERROR` will be used.
31 #
32 function(tribits_report_invalid_tribits_usage)
33 if ("${${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE}" STREQUAL "")
34 set(${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE FATAL_ERROR)
35 endif()
36 set(printErrMsgMode ${${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE})
37 set(ignoreValues "IGNORE" "OFF")
38 if(${PROJECT_NAME}_ASSERT_CORRECT_TRIBITS_USAGE IN_LIST ignoreValues)
39 set(printErrMsgMode "")
40 endif()
41 if (printErrMsgMode)
42 message_wrapper(${printErrMsgMode} ${ARGN})
43 endif()
44 endfunction()