diff options
author | T.J. Corona <tj.corona@kitware.com> | 2020-07-28 00:56:26 (GMT) |
---|---|---|
committer | T.J. Corona <tj.corona@kitware.com> | 2020-07-28 14:35:51 (GMT) |
commit | 45ed314bfff5b9b59dcba8139ab1c695a81a05f3 (patch) | |
tree | f408fa48018de296212d76e469f16854dbd18d9e /Modules/BundleUtilities.cmake | |
parent | 7788494257e0a1a22468b5542f9d8c5cb8c3dfed (diff) | |
download | CMake-45ed314bfff5b9b59dcba8139ab1c695a81a05f3.zip CMake-45ed314bfff5b9b59dcba8139ab1c695a81a05f3.tar.gz CMake-45ed314bfff5b9b59dcba8139ab1c695a81a05f3.tar.bz2 |
BundleUtilities: do not run install_name_tool on scripts
Use the same approach as commit 08be74bfd7 (GetPrerequisites: Fix
handling of executable scripts, 2018-12-16, v3.14.0-rc1~206^2).
Diffstat (limited to 'Modules/BundleUtilities.cmake')
-rw-r--r-- | Modules/BundleUtilities.cmake | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 2f3b9e1..f521d22 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -894,11 +894,16 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) # to install_name_tool: # if(changes) - set(cmd ${CMAKE_INSTALL_NAME_TOOL} ${changes} "${resolved_embedded_item}") - execute_process(COMMAND ${cmd} RESULT_VARIABLE install_name_tool_result) - if(NOT install_name_tool_result EQUAL 0) - string(REPLACE ";" "' '" msg "'${cmd}'") - message(FATAL_ERROR "Command failed:\n ${msg}") + # Check for a script by extension (.bat,.sh,...) or if the file starts with "#!" (shebang) + file(READ ${resolved_embedded_item} file_contents LIMIT 5) + 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}") + execute_process(COMMAND ${cmd} RESULT_VARIABLE install_name_tool_result) + if(NOT install_name_tool_result EQUAL 0) + string(REPLACE ";" "' '" msg "'${cmd}'") + message(FATAL_ERROR "Command failed:\n ${msg}") + endif() endif() endif() endfunction() |