This is an archive of the discontinued LLVM Phabricator instance.

[compiler-rt][cmake] Factor out extend_install_path function
ClosedPublic

Authored by Ericson2314 on Dec 14 2021, 12:02 PM.

Details

Summary

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.

Diff Detail

Event Timeline

Ericson2314 created this revision.Dec 14 2021, 12:02 PM
Ericson2314 requested review of this revision.Dec 14 2021, 12:02 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 14 2021, 12:02 PM
Herald added a subscriber: Restricted Project. · View Herald Transcript
Ericson2314 retitled this revision from [compiler-rt] Factor out extend_install_path function to [compiler-rt][cmake] Factor out extend_install_path function.Dec 14 2021, 12:14 PM

Rebase to hopefully fix pre-merge CI

Seems like a reasonable refactoring to me.

cmake/Modules/ExtendInstallPath.cmake
1

s/of/or/?

4

It seems odd to me to have the second argument be the return value. I'd prefer having it as the first argument and passing prefix_var as a value, rather than as a variable name.

Since you've named it 'extend_install_path' ten perhaps 'prefix_var' should be 'install_path'?

lastly, the documentation leave something to be desired. I would say something like:
"Extend the path in prefix_var with the relative path in current_segment, returning the result in joined_path. If current_segment is an absolute path then just return it and issue a warning.
Note that the code returns a relative path (avoiding introducing leading slashes) if the prefix_var is empty."

This revision is now accepted and ready to land.Dec 28 2021, 8:41 PM
Ericson2314 edited the summary of this revision. (Show Details)Dec 28 2021, 10:22 PM

Make changes in response to review

Many thanks @stephenneuendorffer for reviewing! I hope the changes I made are in line with what you were thinking.

This revision was landed with ongoing or failed builds.Dec 29 2021, 10:19 PM
This revision was automatically updated to reflect the committed changes.