1# Extend the path in `base_path` with the path in `current_segment`, returning 2# the result in `joined_path`. If `current_segment` is an absolute path then 3# just return it, in effect overriding `base_path`, and issue a warning. 4# 5# Note that the code returns a relative path (avoiding introducing leading 6# slashes) if `base_path` is empty. 7function(extend_path joined_path base_path current_segment) 8 if("${current_segment}" STREQUAL "") 9 set(temp_path "${base_path}") 10 elseif("${base_path}" STREQUAL "") 11 set(temp_path "${current_segment}") 12 elseif(IS_ABSOLUTE "${current_segment}") 13 message(WARNING "Since \"${current_segment}\" is absolute, it overrides base path: \"${base_path}\".") 14 set(temp_path "${current_segment}") 15 else() 16 set(temp_path "${base_path}/${current_segment}") 17 endif() 18 set(${joined_path} "${temp_path}" PARENT_SCOPE) 19endfunction() 20