diff --git a/cmake/QtIRCommandLineHelpers.cmake b/cmake/QtIRCommandLineHelpers.cmake index d3569dd7..b932fcdf 100644 --- a/cmake/QtIRCommandLineHelpers.cmake +++ b/cmake/QtIRCommandLineHelpers.cmake @@ -421,3 +421,17 @@ function(qt_ir_get_option_as_cmake_flag_option cli_name cmake_option_name out_va endif() set(${out_var} "${cmake_option}" PARENT_SCOPE) endfunction() + +# Get the value of a command line option as existing absolute path. +# Yield error if the path does not exist. +# Convert to absolute path if necessary. +function(qt_ir_get_option_as_existing_absolute_path name value) + qt_ir_get_option_value("${name}" path) + if(NOT EXISTS "${abspath}") + qt_ir_add_error("The path '${path}' passed with -${name} does not exist.") + endif() + if(NOT IS_ABSOLUTE "${path}") + get_filename_component(path "${path}" ABSOLUTE) + endif() + set("${value}" "${path}" PARENT_SCOPE) +endfunction() diff --git a/cmake/QtIRHelpers.cmake b/cmake/QtIRHelpers.cmake index c305ae80..c4d8b7f2 100644 --- a/cmake/QtIRHelpers.cmake +++ b/cmake/QtIRHelpers.cmake @@ -295,7 +295,7 @@ function(qt_ir_run_after_args_parsed top_level_src_path out_var_exit_reason) "${working_directory}") # Get some additional options to pass down. - qt_ir_get_option_value(alternates alternates) + qt_ir_get_option_as_existing_absolute_path(alternates alternates) qt_ir_get_option_as_cmake_flag_option(branch "CHECKOUT_BRANCH" checkout_branch_option) # The prefix for the cmake-style 'dictionary' that will be used by various functions.