diff options
author | Brad King <brad.king@kitware.com> | 2010-12-14 19:37:36 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2010-12-14 19:37:36 (GMT) |
commit | dba6b2be54e709d2b1062bb71df314e8eb592cc4 (patch) | |
tree | b7f7dfd2a4b5a72f77ceeafa39cbd49b8c449801 | |
parent | b7c29a4d7330857c672f0285e2a4e18fa90374b2 (diff) | |
parent | c2895f48a4e79af49937b9e6a260076440b1a67a (diff) | |
download | CMake-dba6b2be54e709d2b1062bb71df314e8eb592cc4.zip CMake-dba6b2be54e709d2b1062bb71df314e8eb592cc4.tar.gz CMake-dba6b2be54e709d2b1062bb71df314e8eb592cc4.tar.bz2 |
Merge topic 'BundleUtilities-should-produce-error-if-item-is-not-embedded'
c2895f4 BundleUtilities: error if fixup_bundle_item called on non-embedded item
-rw-r--r-- | Modules/BundleUtilities.cmake | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Modules/BundleUtilities.cmake b/Modules/BundleUtilities.cmake index 48830cb..44f2c20 100644 --- a/Modules/BundleUtilities.cmake +++ b/Modules/BundleUtilities.cmake @@ -27,6 +27,11 @@ # drag-n-drop copied to another machine and run on that machine as long as all # of the system libraries are compatible. # +# If you pass plugins to fixup_bundle as the libs parameter, you should install +# them or copy them into the bundle before calling fixup_bundle. The "libs" +# parameter is a list of libraries that must be fixed up, but that cannot be +# determined by otool output analysis. (i.e., plugins) +# # Gather all the keys for all the executables and libraries in a bundle, and # then, for each key, copy each prerequisite into the bundle. Then fix each one # up according to its own list of prerequisites. @@ -112,6 +117,13 @@ # _EMBEDDED_ITEM keyed variable for that prerequisite. (Most likely changing to # an "@executable_path" style reference.) # +# This function requires that the resolved_embedded_item be "inside" the bundle +# already. In other words, if you pass plugins to fixup_bundle as the libs +# parameter, you should install them or copy them into the bundle before +# calling fixup_bundle. The "libs" parameter is a list of libraries that must +# be fixed up, but that cannot be determined by otool output analysis. (i.e., +# plugins) +# # Also, change the id of the item being fixed up to its own _EMBEDDED_ITEM # value. # @@ -527,6 +539,24 @@ function(fixup_bundle_item resolved_embedded_item exepath dirs) # get_item_key("${resolved_embedded_item}" ikey) + # Ensure the item is "inside the .app bundle" -- it should not be fixed up if + # it is not in the .app bundle... Otherwise, we'll modify files in the build + # tree, or in other varied locations around the file system, with our call to + # install_name_tool. Make sure that doesn't happen here: + # + get_dotapp_dir("${exepath}" exe_dotapp_dir) + string(LENGTH "${exe_dotapp_dir}/" exe_dotapp_dir_length) + string(SUBSTRING "${resolved_embedded_item}" 0 ${exe_dotapp_dir_length} item_substring) + if(NOT "${exe_dotapp_dir}/" STREQUAL "${item_substring}") + message(" exe_dotapp_dir/='${exe_dotapp_dir}/'") + message(" item_substring='${item_substring}'") + message(" resolved_embedded_item='${resolved_embedded_item}'") + message("") + message("Install or copy the item into the bundle before calling fixup_bundle") + message("") + message(FATAL_ERROR "cannot fixup an item that is not in the bundle...") + endif() + set(prereqs "") get_prerequisites("${resolved_embedded_item}" prereqs 1 0 "${exepath}" "${dirs}") |