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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits