The specific cause is when e.g.
/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/libgio-2.0.0.dylib
is detected by fixup_bundle. set_bundle_key_values() interprets this as
a framework, thus doing a string replace that creates an embedded_item
that is equal to the original path, i.e. it is not embedded.
The `otool` command may return multiple RPATH entires, so call
`gp_append_unique` for each one. Otherwise we may try to ask
`install_name_tool` to deal with the same entry twice.
This restores Qt SDK 4.8 and OS X >= 10.6.5 codesign compatibility
improving embedding frameworks using correct bundle layout described at:
https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Concepts/FrameworkAnatomy.html
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.
This is done by gathering LC_RPATH commands for main bundle executable and
using it for @rpath lookup in dependent frameworks.
All functions that need to carry rpaths to now take optional <rpaths> argument.
This enabled apps using @rpath to be bundled correctly, which will be necessary
for upcoming Qt 5.4 that will use @rpath for all frameworks.
Check that install_name_tool has -delete_rpath before using it.
Otherwise it will fail with Xcode 3.x on 10.5 which has no -delete_rpath
option for install_name_tool command, that was first introduced in 10.6
SDK, even that 10.5 supports LC_RPATH and @rpath.
It makes whole executable process quicker on UNIX, especially for large bundles
containing many files, since using find narrows results to only files having
executable flags then all further tests follow.
Since find ... -perm +0111 is not clearly POSIX compliant and some Linux
versions refuse it, it is better to use longer but portable:
find ... -perm \( -perm -0100 -o -perm -0010 -o -perm -0001 \)
Some frameworks might be built with the library right at the root
of the framework rather than down in a versioned sub-folder with
a symlink at the root.
Make one of the slashes in the REGEX optional so BundleUtilities
can still properly work with such frameworks ... even if they are
weird. ;-)
Thanks to Tobias Hieta for the bug report and for trying out the fix
before I pushed this commit.
Ancient versions of CMake required else(), endif(), and similar block
termination commands to have arguments matching the command starting the
block. This is no longer the preferred style.
Run the following shell code:
for c in else endif endforeach endfunction endmacro endwhile; do
echo 's/\b'"$c"'\(\s*\)(.\+)/'"$c"'\1()/'
done >convert.sed &&
git ls-files -z -- bootstrap '*.cmake' '*.cmake.in' '*CMakeLists.txt' |
egrep -z -v '^(Utilities/cm|Source/kwsys/)' |
egrep -z -v 'Tests/CMakeTests/While-Endwhile-' |
xargs -0 sed -i -f convert.sed &&
rm convert.sed
51e16c0 BundleUtilities: Avoid test on Watcom dashboards (#12034)
41f962a Revert "BundleUtilities: Run test on Windows if either MSVC or dumpbin was found."
e17135e BundleUtilities: Add rpath to loadable modules in test.
8064044 BundleUtilities: Print reason for not loading module.so
f3de459 BundleUtilities: Run test on Windows if either MSVC or dumpbin was found.
900bf98 BundleUtilities: Disable running test on Windows unless using MSVC.
fa4dc08 BundleUtilities: Fix issues with custom target DEPENDS in test (#12034)
e40b79e BundleUtilities: Fix test when using xcode (#12034)
b68d3dc BundleUtilities: Fix regex to extract dependents from ldd (#12034)
7ac7b43 BundleUtilities: Work w/ non .app exes on Mac (#12034)
When the path to "resolved_embedded_item" was shorter than
the path to the bundle being fixed up, fixup_bundle would
fail with a cmake error like:
"string end index: 110 is out of range 0 - 85"
Detect when the path of resolved_embedded_item is too short
to be embedded in the bundle, and report the proper error
message, so the poor developer reading it has a snowball's
chance of actually fixing the issue.
Also add a test of BundleUtilities including an exe,
some shared libs, a plugin, and a framework-style lib.
This test presently runs (and this functionality works)
on Linux, Mac and Windows.
For now, the framework-style lib is built as a plain old
shared lib because there is another yet-unresolved issue
with local frameworks without rpaths on the Mac.
Also, improve the documentation of the fixup_bundle and fixup_bundle_item
functions to clarify that plugin type "libs" need to be copied into
the bundle *before* calling fixup_bundle.
Commit e93a4b4d34 changed the way that
the libs parameter to fixup_bundle is interpreted. Before the commit,
the libs were copied into the bundle first and then fixed up. After
the commit, the copy was skipped, assuming the libs were in the bundle
in the first place, and then the fixups occurred as before.
However, before the commit, it was possible to name a lib from outside
the bundle, and have it copied in and then fixed up. Its resolved
embedded name was always inside the bundle before. After, its resolved
embedded name was just the same as its resolved name, which is in its
original location, and not necessarily inside the bundle.
This manifested itself as a problem with the ParaView call to
fixup_bundle and its many plugins. Previously, ParaView had simply
passed in the list of plugin file names as they existed in the build
tree, and left the copying into the bundle up to the fixup_bundle
function. When built with CMake 2.8.3 (the first version to contain
the above named commit) the fixup_bundle call would inadventently
fixup libraries in the build tree, not libraries that were in the
bundle. Furthermore, the plugins would not be in the final bundle.
This points out the fact that the fix for the bugs made by the above
commit was a backwards-incompatible change in behavior.
This commit makes it an error to try to fixup an item that is not
already inside the bundle to make the change in behavior apparent
to folks who were depending on the prior copy-in behavior: now,
they should get an error, and hopefully, reading the new and
improved documentation, should be able to resolve it in their
projects by adding code to install or copy in such libraries prior
to calling fixup_bundle.
Whew.
This ensures that any bundle items are made user writable before
any attempt is made to alter them using install_name_tool. This is
because MacPorts/Fink/Homebrew don't install libraries as writable.
This fix is needed to allow fixup_bundle_item to work correctly
when ingesting libraries installed by these package managers.
of http://github.com/themiwi/CMake
into fix-10747
Conflicts:
Modules/BundleUtilities.cmake
There was one newly added function in BundleUtilities.cmake
which also needed the same "documentation at top" treatment.
By default, if an embedded item is a framework, copy its
main dylib file explicitly, and then also its Resources
if it has any.
Inspect a variable, BU_COPY_FULL_FRAMEWORK_CONTENTS, and
if it's ON, copy the entire framework into the bundle.
Put the function documentation into the header-comment, improve
formatting and list the user-relevant functions first.
Signed-off-by: Michael Wild <themiwi@users.sourceforge.net>
This adds copyright/license notification blocks CMake's non-find
modules. Most of the modules had no notices at all. Some had notices
referring to the BSD license already. This commit normalizes existing
notices and adds missing notices.
Formerly, fixup_bundle was useful only on the Mac for making standalone bundle applications that could be drag-n-drop moved to anyplace in the file system. fixup_bundle is not just for the Mac any more. It will now analyze executable files on Windows and Linux, too, and copy necessary non-system dlls to the same folder that the executable is in. This should work with dlls that you build as part of your build and also with 3rd-party dlls as long as you give fixup_bundle the right list of directories to search for those dlls. Many thanks to Clinton Stimpson for his help in ironing out the details involved in making this work.