summaryrefslogtreecommitdiff
path: root/scripts/cmake/util_functions.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/cmake/util_functions.cmake')
-rw-r--r--scripts/cmake/util_functions.cmake9
1 files changed, 9 insertions, 0 deletions
diff --git a/scripts/cmake/util_functions.cmake b/scripts/cmake/util_functions.cmake
index 06ae184..f9742f7 100644
--- a/scripts/cmake/util_functions.cmake
+++ b/scripts/cmake/util_functions.cmake
@@ -84,6 +84,15 @@ function(USER_OPTION name description default type)
endfunction()
+
+# Function to check if a variable is defined, and throw
+# an error if it is not.
+function(assert_defined var_name)
+ if (NOT DEFINED ${var_name})
+ message(FATAL_ERROR "ERROR: ${var_name} is undefined!")
+ endif()
+endfunction()
+
# Function to get the path type for a variable
# Args:
# path_var[in]: path variable for which the cmake path type is requested