| 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 |
|
| 13 |
# @MACRO: tribits_advanced_set_cache_var_and_default() |
| 14 |
# |
| 15 |
# Set an advanced cache variable with a default value (passing in a default |
| 16 |
# default value). |
| 17 |
# |
| 18 |
# Usage:: |
| 19 |
# |
| 20 |
# tribits_advanced_set_cache_var_and_default(<cacheVarName> <cacheVarType> |
| 21 |
# <defaultDefaultVal> <docString>) |
| 22 |
# |
| 23 |
# If the variable ``<cacheVarName>_DEFAULT`` already exists with a value, that |
| 24 |
# is used as the default cache variable. Otherwise, |
| 25 |
# ``<cacheVarName>_DEFAULT`` is set set to ``<defaultDefaultVal>`` first. |
| 26 |
# |
| 27 |
macro(tribits_advanced_set_cache_var_and_default cacheVarName cacheVarType |
| 28 |
defaultDefaultVal docString |
| 29 |
) |
| 30 |
tribits_set_cache_var_and_default("${cacheVarName}" "${cacheVarType}" |
| 31 |
"${defaultDefaultVal}" "${docString}") |
| 32 |
mark_as_advanced(${cacheVarName}) |
| 33 |
endmacro() |
| 34 |
|
| 35 |
|
| 36 |
# @MACRO: tribits_set_cache_var_and_default() |
| 37 |
# |
| 38 |
# Set a cache variable with a default value (passing in a default default |
| 39 |
# value). |
| 40 |
# |
| 41 |
# Usage:: |
| 42 |
# |
| 43 |
# tribits_set_cache_var_and_default(<cacheVarName> <cacheVarType> |
| 44 |
# <defaultDefaultVal> <docString>) |
| 45 |
# |
| 46 |
# If the variable ``<cacheVarName>_DEFAULT`` already exists with a value, that |
| 47 |
# is used as the default cache variable. Otherwise, |
| 48 |
# ``<cacheVarName>_DEFAULT`` is set set to ``<defaultDefaultVal>`` first. |
| 49 |
# |
| 50 |
macro(tribits_set_cache_var_and_default cacheVarName cacheVarType |
| 51 |
defaultDefaultVal docString |
| 52 |
) |
| 53 |
if ("${${cacheVarName}_DEFAULT}" STREQUAL "") |
| 54 |
set(${cacheVarName}_DEFAULT "${defaultDefaultVal}") |
| 55 |
endif() |
| 56 |
set(${cacheVarName} "${${cacheVarName}_DEFAULT}" |
| 57 |
CACHE ${cacheVarType} |
| 58 |
"${docString}" ) |
| 59 |
endmacro() |