-
Notifications
You must be signed in to change notification settings - Fork 752
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[compiler-rt][cmake] Factor out extend_install_path function
It is likely to become used again, if other projects want their own per-project install directory variables. `install` is removed from the name since it is not inherently about installing. Reviewed By: stephenneuendorffer Differential Revision: https://reviews.llvm.org/D115746
- Loading branch information
1 parent
458db51
commit bde561c
Showing
2 changed files
with
25 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Extend the path in `base_path` with the path in `current_segment`, returning | ||
# the result in `joined_path`. If `current_segment` is an absolute path then | ||
# just return it, in effect overriding `base_path`, and issue a warning. | ||
# | ||
# Note that the code returns a relative path (avoiding introducing leading | ||
# slashes) if `base_path` is empty. | ||
function(extend_path joined_path base_path current_segment) | ||
if("${current_segment}" STREQUAL "") | ||
set(temp_path "${base_path}") | ||
elseif("${base_path}" STREQUAL "") | ||
set(temp_path "${current_segment}") | ||
elseif(IS_ABSOLUTE "${current_segment}") | ||
message(WARNING "Since \"${current_segment}\" is absolute, it overrides install path: \"${base_path}\".") | ||
set(temp_path "${current_segment}") | ||
else() | ||
set(temp_path "${base_path}/${current_segment}") | ||
endif() | ||
set(${joined_path} "${temp_path}" PARENT_SCOPE) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters