[clang] f359eac - [CMake][Clang] Copy folder without permissions

Sebastian Neubauer via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 22 01:39:12 PDT 2022


Author: Sebastian Neubauer
Date: 2022-07-22T10:38:54+02:00
New Revision: f359eac5df06c1062019fad9aac41f4320899c5f

URL: https://github.com/llvm/llvm-project/commit/f359eac5df06c1062019fad9aac41f4320899c5f
DIFF: https://github.com/llvm/llvm-project/commit/f359eac5df06c1062019fad9aac41f4320899c5f.diff

LOG: [CMake][Clang] Copy folder without permissions

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.

Differential Revision: https://reviews.llvm.org/D130254

Added: 
    

Modified: 
    clang/cmake/modules/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/clang/cmake/modules/CMakeLists.txt b/clang/cmake/modules/CMakeLists.txt
index c6f6ce9fe5d69..c6afdab40d65b 100644
--- a/clang/cmake/modules/CMakeLists.txt
+++ b/clang/cmake/modules/CMakeLists.txt
@@ -32,8 +32,10 @@ set(CLANG_CONFIG_LLVM_CMAKE_DIR)
 
 # 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
   )


        


More information about the cfe-commits mailing list