Debian Codegraph @

cmake/tribits/core/utils/SetDefault.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 # @MACRO: set_default()
12 #
13 # Give a local variable a default value if a non-empty value is not already
14 # set.
15 #
16 # Usage::
17 #
18 # set_default(<varName> <arg0> <arg1> ...)
19 #
20 # If on input ``"${<varName>}"==""``, then ``<varName>`` is set to the given
21 # default ``<arg0> <arg1> ...``. Otherwise, the existing non-empty value is
22 # preserved.
23 #
24 macro(set_default VAR)
25 if ("${${VAR}}" STREQUAL "")
26 set(${VAR} ${ARGN})
27 endif()
28 endmacro()