[PATCH] D130254: [CMake][Clang] Copy folder without permissions

Sebastian Neubauer via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 21 05:12:42 PDT 2022


sebastian-ne created this revision.
sebastian-ne added reviewers: awarzynski, PeteSteinfeld.
Herald added a subscriber: mgorny.
Herald added a project: All.
sebastian-ne requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Copying the folder keeps the original permissions by default. This
creates problems when the source folder is read-only, e.g. in a
packaging environment.
Then, the copied folder in the build directory is read-only as well.
Later on, with configure_file, ClangConfig.cmake is copied into that
directory (in the build tree), failing when the directory is read-only.

Fix that problem by copying the folder without keeping the original
permissions.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D130254

Files:
  clang/cmake/modules/CMakeLists.txt


Index: clang/cmake/modules/CMakeLists.txt
===================================================================
--- clang/cmake/modules/CMakeLists.txt
+++ clang/cmake/modules/CMakeLists.txt
@@ -32,8 +32,10 @@
 
 # For compatibility with projects that include(ClangConfig)
 # via CMAKE_MODULE_PATH, place API modules next to it.
+# Copy without source permissions because the source could be read-only
 file(COPY .
   DESTINATION ${clang_cmake_builddir}
+  NO_SOURCE_PERMISSIONS
   FILES_MATCHING PATTERN *.cmake
   PATTERN CMakeFiles EXCLUDE
   )


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D130254.446442.patch
Type: text/x-patch
Size: 545 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220721/8ce065b6/attachment.bin>


More information about the cfe-commits mailing list