summaryrefslogtreecommitdiffstats
path: root/Modules/BundleUtilities.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-02-20 18:14:05 (GMT)
committerBrad King <brad.king@kitware.com>2023-02-20 18:17:04 (GMT)
commit1430f7f5741a4c608cddfe4d4da34466b0f1489e (patch)
tree8a9bc222695a2c2d13c8625a3c12136dc0b6f2eb /Modules/BundleUtilities.cmake
parent3b3f2e920bc33882b0f19046995ccb61c5ddaf87 (diff)
downloadCMake-1430f7f5741a4c608cddfe4d4da34466b0f1489e.zip
CMake-1430f7f5741a4c608cddfe4d4da34466b0f1489e.tar.gz
CMake-1430f7f5741a4c608cddfe4d4da34466b0f1489e.tar.bz2
BundleUtilities: Avoid unnecessary chmod in fixup_bundle_item
Move the permissions modification added by commit 88fed668b1 (Make bundle items writable before fixup, 2010-09-07, v2.8.3~129^2) inside the condition added by commit 45ed314bff (BundleUtilities: do not run install_name_tool on scripts, 2020-07-27, v3.19.0-rc1~404^2). There is no reason to add write permissions to a file that we are not going to modify. Fixes: #24424
Diffstat (limited to 'Modules/BundleUtilities.cmake')
-rw-r--r--Modules/BundleUtilities.cmake7
1 files changed, 3 insertions, 4 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index 0beff04..5307901 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -870,10 +870,6 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
endif()
endforeach()
- if(BU_CHMOD_BUNDLE_ITEMS)
- execute_process(COMMAND chmod u+w "${resolved_embedded_item}")
- endif()
-
# CMAKE_INSTALL_NAME_TOOL may not be set if executed in script mode
# Duplicated from CMakeFindBinUtils.cmake
find_program(CMAKE_INSTALL_NAME_TOOL NAMES install_name_tool HINTS ${_CMAKE_TOOLCHAIN_LOCATION})
@@ -903,6 +899,9 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs)
if(NOT "${resolved_embedded_item}" MATCHES "\\.(bat|c?sh|bash|ksh|cmd)$" AND
NOT file_contents MATCHES "^#!")
set(cmd ${CMAKE_INSTALL_NAME_TOOL} ${changes} "${resolved_embedded_item}")
+ if(BU_CHMOD_BUNDLE_ITEMS)
+ execute_process(COMMAND chmod u+w "${resolved_embedded_item}")
+ endif()
execute_process(COMMAND ${cmd} RESULT_VARIABLE install_name_tool_result)
if(NOT install_name_tool_result EQUAL 0)
string(REPLACE ";" "' '" msg "'${cmd}'")