| 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(AssertDefined) |
| 11 |
include(AppendStringVarWithSep) |
| 12 |
|
| 13 |
|
| 14 |
# @FUNCTION: print_nonempty_var_with_spaces() |
| 15 |
# |
| 16 |
# Print a list variable giving its name then value printed with spaces instead |
| 17 |
# of ``';'``, but only if the list is non-empty. |
| 18 |
# |
| 19 |
# Usage:: |
| 20 |
# |
| 21 |
# print_nonempty_var_with_spaces(<varName> <printedVarOut>) |
| 22 |
# |
| 23 |
# Prints the variable as:: |
| 24 |
# |
| 25 |
# <varName>: <ele0> <ele1> ... |
| 26 |
# |
| 27 |
# If ``<printedVarOut>`` is ``TRUE`` on input, then the variable is not |
| 28 |
# touched. If however, the variable ``<printedVarOut>`` is not ``TRUE`` and |
| 29 |
# the list ``<varName>`` in non-empty, then ``<printedVarOut>`` is set to |
| 30 |
# ``TRUE`` on output. |
| 31 |
# |
| 32 |
function(print_nonempty_var_with_spaces variableName printedVarOut) |
| 33 |
if (NOT "${${variableName}}" STREQUAL "") |
| 34 |
string(REPLACE ";" " " OUTSTR "${${variableName}}") |
| 35 |
message("-- ${variableName}: ${OUTSTR}") |
| 36 |
set(${printedVarOut} TRUE PARENT_SCOPE) |
| 37 |
endif() |
| 38 |
endfunction() |