summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorAdam Strzelecki <ono@java.pl>2014-09-04 13:01:17 (GMT)
committerBrad King <brad.king@kitware.com>2014-10-10 14:17:04 (GMT)
commit83a06bb4abb0302c70095c70306f9d51071c02e4 (patch)
treea71f66e0080d67fdfdf6f6992b25775155b19aea /Modules
parentf7df82acaaf83515c84d2aa006a06b94f144953e (diff)
downloadCMake-83a06bb4abb0302c70095c70306f9d51071c02e4.zip
CMake-83a06bb4abb0302c70095c70306f9d51071c02e4.tar.gz
CMake-83a06bb4abb0302c70095c70306f9d51071c02e4.tar.bz2
BundleUtilities: Framework codesign Resources/Info.plist & Current
We need to ensure copied framework has proper layout with Resources/Info.plist present next to versioned binary and Current symlink in Versions: https://developer.apple.com/library/mac/technotes/tn2206 https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html If Resources/ is not present we may try to copy Contents/Info.plist if present to embedded Resources/Info.plist. This is a case of Qt5 that has obsolete/invalid framework layout (see QTBUG-38511).
Diffstat (limited to 'Modules')
-rw-r--r--Modules/BundleUtilities.cmake23
1 files changed, 21 insertions, 2 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake
index f7f7128..445c719 100644
--- a/Modules/BundleUtilities.cmake
+++ b/Modules/BundleUtilities.cmake
@@ -650,11 +650,30 @@ function(copy_resolved_framework_into_bundle resolved_item resolved_embedded_ite
execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_item}" "${resolved_embedded_item}")
# Plus Resources, if they exist:
- string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_resources "${resolved_item}")
- string(REGEX REPLACE "^(.*)/[^/]+/[^/]+/[^/]+$" "\\1/Resources" resolved_embedded_resources "${resolved_embedded_item}")
+ string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources" resolved_resources "${resolved_item}")
+ string(REGEX REPLACE "^(.*)/[^/]+$" "\\1/Resources" resolved_embedded_resources "${resolved_embedded_item}")
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}")
+ else()
+ # Otherwise try at least copy Contents/Info.plist to Resources/Info.plist, if it exists:
+ 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}")
+ #message(STATUS "copying COMMAND ${CMAKE_COMMAND} -E copy_directory '${resolved_info_plist}' '${resolved_embedded_info_plist}'")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy "${resolved_info_plist}" "${resolved_embedded_info_plist}")
+ endif()
+ endif()
+
+ # Check if framework is versioned and fix it layout
+ string(REGEX REPLACE "^.*/([^/]+)/[^/]+$" "\\1" resolved_embedded_version "${resolved_embedded_item}")
+ string(REGEX REPLACE "^(.*)/[^/]+/[^/]+$" "\\1" resolved_embedded_versions "${resolved_embedded_item}")
+ string(REGEX REPLACE "^.*/([^/]+)/[^/]+/[^/]+$" "\\1" resolved_embedded_versions_basename "${resolved_embedded_item}")
+ if(resolved_embedded_versions_basename STREQUAL "Versions")
+ # Ensure Current symlink points to the framework version
+ if(NOT EXISTS "${resolved_embedded_versions}/Current")
+ execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${resolved_embedded_version}" "${resolved_embedded_versions}/Current")
+ endif()
endif()
endif()
if(UNIX AND NOT APPLE)