[CMake] CPack packaging portable binaries with external shared libraries

Zack Galbreath zack.galbreath at kitware.com
Wed Jun 18 17:12:52 EDT 2014


On Wed, Jun 18, 2014 at 10:14 AM, Sankhesh Jhaveri <
sankhesh.jhaveri at kitware.com> wrote:

>
> Any ideas/suggestions how to properly package Linux archive?
>
>


This has worked for me in the past:

set(origin "$ORIGIN")
if (APPLE)
  set(origin "@executable_path")
endif()
set(CMAKE_INSTALL_RPATH "${origin}/../lib:${origin}/")

This was for a project with a typical install tree: the executables in bin/
and the libraries in a sibling directory named lib/.  The only other trick
was to tell fixup_bundle() to ignore the files in the lib/ dir of the
install tree.  I did this by defining the following function before my call
to fixup_bundle():

function(gp_resolved_file_type_override resolved_file type_var)
  if(resolved_file MATCHES "\\.\\./lib")
    set(${type_var} "local" PARENT_SCOPE)
  endif()
endfunction()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140618/68e7f3f6/attachment.html>


More information about the CMake mailing list