[PATCH] D79400: [CMAKE] Fix build failure when source directory is read only

Pushpinder Singh via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 26 05:22:27 PDT 2020


pdhaliwal added a comment.

> 3. Another way is to gracefully handle the file write error, for which I don't think there is a portable way. (which @scott.linder also suggested)

I have found the portable way to do this. So cmake provides a command-line tool `touch` (doc <https://cmake.org/cmake/help/v3.7/manual/cmake.1.html#command-line-tool-mode>) which can be used with `execute_process` <https://cmake.org/cmake/help/v3.0/command/execute_process.html>. `execute_process` provides a way to suppress the failure using `ERROR_QUIET` option. Coming back to `touch`, it behaves similar to `file(WRITE ..)` command  however, additionally the exit code can be used to check if file was created successfully. This retains the old behaviour while still solving the original problem. I will update the patch.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79400/new/

https://reviews.llvm.org/D79400





More information about the llvm-commits mailing list