| 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 |
# @FUNCTION: print_var() |
| 13 |
# |
| 14 |
# Unconditionally print a variable giving its name then value. |
| 15 |
# |
| 16 |
# Usage:: |
| 17 |
# |
| 18 |
# print_var(<varName>) |
| 19 |
# |
| 20 |
# This prints:: |
| 21 |
# |
| 22 |
# message("-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'") |
| 23 |
# |
| 24 |
# The variable ``<varName>`` can be defined or undefined or empty. This uses |
| 25 |
# an explicit "-- " line prefix so that it prints nice even on Windows CMake. |
| 26 |
# |
| 27 |
function(print_var VARIBLE_NAME) |
| 28 |
if (MESSAGE_WRAPPER_UNIT_TEST_MODE) |
| 29 |
global_set(MESSAGE_WRAPPER_INPUT "${MESSAGE_WRAPPER_INPUT}" |
| 30 |
"-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'" "${PRINT_MSG}") |
| 31 |
else() |
| 32 |
message("-- " "${VARIBLE_NAME}='${${VARIBLE_NAME}}'") |
| 33 |
endif() |
| 34 |
endfunction() |
| 35 |
|
| 36 |
# NOTE: Above, I was not able to call message_wrapper() directly because it |
| 37 |
# was removing the ';' in array arguments. This broke a bunch of unit tests. |
| 38 |
# Therefore, I have to duplicate code and call it in two separate places. I |
| 39 |
# have to admit that CMake behavior surprises me many times. This is not a |
| 40 |
# great programming language. |