Debian Codegraph @

cmake/tribits/core/utils/Split.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
11 # @FUNCTION: split()
12 #
13 # Split a string variable into a string array/list variable.
14 #
15 # Usage::
16 #
17 # split("<inputStr>" "<sepStr>" <outputStrListVar>)
18 #
19 # The ``<sepStr>`` string is used with ``string(REGEX ...)`` to replace all
20 # occurrences of ``<sepStr>`` in ``<inputStr>`` with ``";"`` and writing into
21 # ``<outputStrListVar>``.
22 #
23 # WARNING: ``<sepStr>`` is interpreted as a regular expression (regex) so keep
24 # that in mind when considering special regex chars like ``'*'``, ``'.'``,
25 # etc!
26 #
27 function(split INPUT_STRING SEP_STR OUTPUT_STRING_VAR)
28 string(REGEX REPLACE "${SEP_STR}" ";" OUTPUT_STRING "${INPUT_STRING}")
29 set(${OUTPUT_STRING_VAR} "${OUTPUT_STRING}" PARENT_SCOPE)
30 endfunction()