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 ecd9d2a..06ae184 100644
--- a/scripts/cmake/util_functions.cmake
+++ b/scripts/cmake/util_functions.cmake
@@ -23,11 +23,20 @@ function(USER_OPTION name description default type)
if (${type} STREQUAL PATH_OR_FILE)
if (DEFINED ${name})
+ get_filename_component(ABSPATH "${${name}}" ABSOLUTE BASE_DIR ${CMAKE_SOURCE_DIR})
+
get_path_type(${${name}} PATH_TYPE)
else()
+ get_filename_component(ABSPATH "${default}" ABSOLUTE BASE_DIR ${CMAKE_SOURCE_DIR})
+
get_path_type(${default} PATH_TYPE)
endif()
+ if (NOT EXISTS ${ABSPATH})
+ message(FATAL_ERROR
+ "Invalid directory or file path. Description: ${description}; Path: ${ABSPATH}")
+ endif()
+
# Set the default type if path is not a dir or file path (or undefined)
if (NOT ${PATH_TYPE} STREQUAL PATH AND NOT ${PATH_TYPE} STREQUAL FILEPATH)
message(FATAL_ERROR "Invalid ${name}. It should be a dir or file path.")