Debian Codegraph @

cmake/tribits/core/utils/TribitsPrintList.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 # @FUNCTION: tribits_print_list()
13 #
14 # Unconditionally the name and values of a list var.
15 #
16 # Usage::
17 #
18 # tribits_print_list(<listName>)
19 #
20 # This prints::
21 #
22 # -- <listName> (size=<len>):
23 # -- <val0>
24 # -- <val1>
25 # ...
26 # -- <valN>
27 #
28 # The variable ``<listName>`` can be defined or undefined or empty. This uses
29 # an explicit "-- " line prefix so that it prints nice even on Windows CMake.
30 #
31 function(tribits_print_list listName)
32 list(LENGTH ${listName} len)
33 message("-- " "${listName} (size=${len})")
34 foreach(ele IN LISTS ${listName})
35 message("-- " " '${ele}'")
36 endforeach()
37 endfunction()
38
39 # NOTE: Above, I was not able to call message_wrapper() directly because it
40 # was removing the ';' in array arguments. This broke a bunch of unit tests.
41 # Therefore, I have to duplicate code and call it in two separate places. I
42 # have to admit that CMake behavior surprises me many times. This is not a
43 # great programming language.