Debian Codegraph @

cmake/tribits/core/utils/PrintVarWithSpaces.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(AssertDefined)
11 include(AppendStringVarWithSep)
12
13
14 # @FUNCTION: print_var_with_spaces()
15 #
16 # Print a defined variable giving its name then value printed with spaces
17 # instead of ``';'``.
18 #
19 # Usage::
20 #
21 # print_var_with_spaces(<varName> <printedVarInOut>)
22 #
23 # Prints the variable as::
24 #
25 # <varName>: <ele0> <ele1> ...
26 #
27 # If ``$<printedVarInOut>`` is ``TRUE`` on input, then the variable is not
28 # touched. If however, the variable ``$<printedVarInOut>`` is not ``TRUE`` on
29 # input, then it is set to ``TRUE`` on output.
30 #
31 function(print_var_with_spaces VARIBLE_NAME PRINTED_VAR_OUT)
32 assert_defined(VARIBLE_NAME)
33 string(REPLACE ";" " " OUTSTR "${${VARIBLE_NAME}}")
34 message("-- ${VARIBLE_NAME}: ${OUTSTR}")
35 set(${PRINTED_VAR_OUT} TRUE PARENT_SCOPE)
36 endfunction()