[cmake-developers] [CMake 0012382]: fixup_bundle_item dies on libraries copied to a directory outside bundle directory

Mantis Bug Tracker mantis at public.kitware.com
Tue Aug 2 18:47:05 EDT 2011

The following issue has been SUBMITTED. 
Reported By:                Gregory Crosswhite
Assigned To:                
Project:                    CMake
Issue ID:                   12382
Category:                   Modules
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
Date Submitted:             2011-08-02 18:47 EDT
Last Modified:              2011-08-02 18:47 EDT
Summary:                    fixup_bundle_item dies on libraries copied to a
directory outside bundle directory
When using a Linux-style layout for the installation with bin/, lib/, etc. and
directing the required shared libraries to be installed in lib/ instead of bin/,
fixup_bundle_item does not recognize that they have been installed into the
bundle and reports a fatal error.

The problem comes from the fact that when calling fixup_bundle on an executable
in the bin/ directory, fixup_bundle sets the bundle directory to bin/ which is a
sibling but not a parent of lib/, and so fixup_bundle_item does not recognize
that the library it is fixing up has already been put in the bundle.

Steps to Reproduce: 
The attached file has an example setup that triggers the issue;  inside the
ZIPfile are three files which are listed below:

===== CMakeLists.txt =====
cmake_minimum_required(VERSION 2.8.5)


find_package( Boost COMPONENTS thread REQUIRED )
link_directories ( ${Boost_LIBRARY_DIRS} )
include_directories ( ${Boost_INCLUDE_DIRS} )

add_executable(hello hello)
target_link_libraries(hello ${Boost_LIBRARIES})

install(SCRIPT ${CMAKE_BINARY_DIR}/FixBundle.cmake)

===== FixBundle.cmake =====
include (BundleUtilities)

function(gp_item_default_embedded_path item default_embedded_path_var)
  set(${default_embedded_path_var} "@executable_path/../lib" PARENT_SCOPE)

===== hello.cpp =====
#include <iostream>

using namespace std;

int main() {
  cout << "Hello, world!" << endl;
  return 0;

Note that hello.cpp doesn't use Boost, I just included the dependency in order
to make sure that an external non-system shared library was pulled in.

Issue History 
Date Modified    Username       Field                    Change               
2011-08-02 18:47 Gregory CrosswhiteNew Issue                                    
2011-08-02 18:47 Gregory CrosswhiteFile Added: cmake-issue-example.zip          

More information about the cmake-developers mailing list