Commit 41564ff2 authored by Adam Strzelecki's avatar Adam Strzelecki Committed by Brad King

BundleUtilities: Ensure framework symlinks and Info.plist exist

This restores Qt SDK 4.8 and OS X >= 10.6.5 codesign compatibility
improving embedding frameworks using correct bundle layout described at:

1. If Versions/VERSION/Resources/Info.plist is missing, well known
   incorrect locations are checked for Info.plist and Info.plist is
   copied from there, otherwise codesign will fail.

2. Root framework symlinks to binary and Resources are restored to
   point inside Versions/Current, otherwise Qt 4.8 looking for
   Resources/ in framework root will fail.
parent 631fadea
......@@ -655,8 +655,12 @@ function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_ite
if(EXISTS "${resolved_resources}")
#message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_resources}' '${resolved_embedded_resources}'")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory "${resolved_resources}" "${resolved_embedded_resources}")
# Otherwise try at least copy Contents/Info.plist to Resources/Info.plist, if it exists:
# Some frameworks e.g. Qt put Info.plist in wrong place, so when it is
# missing in resources, copy it from other well known incorrect locations:
if(NOT EXISTS "${resolved_resources}/Info.plist")
# Check for Contents/Info.plist in framework root (older Qt SDK):
string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Contents/Info.plist" resolved_info_plist "${resolved_item}")
string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources/Info.plist" resolved_embedded_info_plist "${resolved_embedded_item}")
if(EXISTS "${resolved_info_plist}")
......@@ -674,6 +678,16 @@ function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_ite
if(NOT EXISTS "${resolved_embedded_versions}/Current")
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${resolved_embedded_version}" "${resolved_embedded_versions}/Current")
# Restore symlinks in framework root pointing to current framework
# binary and resources:
string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1" resolved_embedded_root "${resolved_embedded_item}")
string(REGEX REPLACE "^.*/([^/]+)$" "\\1" resolved_embedded_item_basename "${resolved_embedded_item}")
if(NOT EXISTS "${resolved_embedded_root}/${resolved_embedded_item_basename}")
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "Versions/Current/${resolved_embedded_item_basename}" "${resolved_embedded_root}/${resolved_embedded_item_basename}")
if(NOT EXISTS "${resolved_embedded_root}/Resources")
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "Versions/Current/Resources" "${resolved_embedded_root}/Resources")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment