From 903eeb2c681f2008602bf48265ec628e4fdc9225 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 21 Mar 2018 10:38:22 +0200 Subject: Strip out_root when hashing linker input paths This allows moving out_root of simple projects (no rpath, -I$out_root, or similar) without causing a re-link which we use for testing. --- build2/utility.hxx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'build2/utility.hxx') diff --git a/build2/utility.hxx b/build2/utility.hxx index ea47c03..e5c21e7 100644 --- a/build2/utility.hxx +++ b/build2/utility.hxx @@ -403,6 +403,20 @@ namespace build2 extern const path empty_path; extern const dir_path empty_dir_path; + // Hash a path potentially without the specific directory prefix. + // + // If prefix is not empty and is a super-path of the path to hash, then only + // hash the suffix. Note that both paths are assumed to be normalized. + // + // This functionality is normally used to strip out_root from target paths + // being hashed in order to avoid updates in case out_root was moved. Note + // that this should only be done if the result of the update does not + // include the out_root path in any form (as could be the case, for example, + // for debug information, __FILE__ macro expansion, rpath, etc). + // + void + hash_path (sha256&, const path&, const dir_path& prefix = dir_path ()); + // Append all the values from a variable to the C-string list. T is either // target or scope. The variable is expected to be of type strings. // -- cgit v1.1