diff options
author | David Vincze <david.vincze@arm.com> | 2019-08-05 12:58:47 +0200 |
---|---|---|
committer | David Vincze <david.vincze@arm.com> | 2019-08-28 16:51:05 +0200 |
commit | 54d05556f6932f8c145a55f85d6c465310d4360f (patch) | |
tree | 952b6bd544bf8633191c91fbc8a3ecaabea4808d /cmake | |
parent | 1eae254ca993f966c7bfe0abf91d87ce7a37f36b (diff) | |
download | trusted-firmware-m-54d05556f6932f8c145a55f85d6c465310d4360f.tar.gz |
Build: Reorganize BL2 configuration in cmake
This commit moves the BL2 related configuration switches from the
CommonConfig.cmake file to a separate MCUBootConfig.cmake file to
make its maintenance easier.
Change-Id: I3869528bdbd2a5a071f3b3cc4b2782d22114b1ca
Signed-off-by: David Vincze <david.vincze@arm.com>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Common/BuildSys.cmake | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/cmake/Common/BuildSys.cmake b/cmake/Common/BuildSys.cmake index 4de9f3b3dd..396e131d36 100644 --- a/cmake/Common/BuildSys.cmake +++ b/cmake/Common/BuildSys.cmake @@ -159,6 +159,37 @@ function(assert_generator_is) endif() endfunction() +#Check the value of a cache variable whether it is valid. +# +# This function currently only supports 'STRING' type variables and uses +# the 'STRINGS' cache entry property as the validation list. +# +#Examples: +# validate_cache_value(MCUBOOT_SIGNATURE_TYPE) +# +#INPUTS: +# variable_name - (mandatory) - Name of the cache variable to be checked. +# +#OUTPUTS: +# n/a +# +function(validate_cache_value variable_name) + #Check if the type of the variable is STRING. + get_property(_type CACHE ${variable_name} PROPERTY TYPE) + if(NOT ${_type} STREQUAL "STRING") + message(FATAL_ERROR "validate_cache_value: type of CACHE variable must be 'STRING', the type of '${variable_name}' variable is '${_type}'.") + endif() + get_property(_validation_list CACHE ${variable_name} PROPERTY STRINGS) + #Check if validation list is set. + if (NOT _validation_list) + message(FATAL_ERROR "validate_cache_value: CACHE variable '${variable_name}' has no 'STRINGS' validation list set.") + endif() + #See if the value of the variable is in the list. + if (NOT ${${variable_name}} IN_LIST _validation_list) + message(FATAL_ERROR "validate_cache_value: variable value '${${variable_name}}' of variable '${variable_name}' is not matching the validation list ${_validation_list}.") + endif() +endfunction() + #Specify an include path for the compiler # # Specify a global include directory for all non external targets in the current |