Only rerun bindgen when its dependencies change This took a bit of wrangling to get the depfiles working, but I eventually figured it out. ninja -d explain is very useful. Fixed: 597 Change-Id: I909a4c9418e9dc954e3d328da8f3a825e62544e4 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/59005 Reviewed-by: Bob Beck <bbe@google.com> Auto-Submit: David Benjamin <davidben@google.com> Commit-Queue: Bob Beck <bbe@google.com>
diff --git a/cmake/go.cmake b/cmake/go.cmake index 61a01f5..966ad32 100644 --- a/cmake/go.cmake +++ b/cmake/go.cmake
@@ -34,10 +34,7 @@ else() # Ninja expects the target in the depfile to match the output. This is a # relative path from the build directory. - string(LENGTH "${CMAKE_BINARY_DIR}" root_dir_length) - math(EXPR root_dir_length "${root_dir_length} + 1") - string(SUBSTRING "${CMAKE_CURRENT_BINARY_DIR}" ${root_dir_length} -1 target) - set(target "${target}/${dest}") + binary_dir_relative_path(${dest} target) set(depfile "${CMAKE_CURRENT_BINARY_DIR}/${dest}.d") add_custom_command(OUTPUT ${dest}