summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-07-29 12:12:05 (GMT)
committerKitware Robot <kwrobot@kitware.com>2020-07-29 12:12:25 (GMT)
commit37e27aa552c89f56a3b7c1bee048d8693da36cee (patch)
treea995721784510051fdd4b64ffe413624f303a16d /Modules
parentb7522e48a419354df2cfae92111e49307ea1faa3 (diff)
parent45ed314bfff5b9b59dcba8139ab1c695a81a05f3 (diff)
downloadCMake-37e27aa552c89f56a3b7c1bee048d8693da36cee.zip
CMake-37e27aa552c89f56a3b7c1bee048d8693da36cee.tar.gz
CMake-37e27aa552c89f56a3b7c1bee048d8693da36cee.tar.bz2
Merge topic 'fixup_bundle_item-fix'
45ed314bff BundleUtilities: do not run install_name_tool on scripts Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5071
Diffstat (limited to 'Modules')
-rw-r--r--Modules/BundleUtilities.cmake15
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()