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
This commit is contained in:
Brad King
2020-07-29 12:12:05 +00:00
committed by Kitware Robot
6 changed files with 38 additions and 5 deletions
+10 -5
View File
@@ -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()