In my library I have a shared library target and an executable target. I’m trying to use BundleUtilities
and fixup_bundle
to create a tarball like this (I guess I’ll use cPack for packing) with all the dependencies bundled in on a platform that is not macOS:
root
├── bin
│ └── myprogram
├── lib64
│ ├── libdep1
│ ├── libdep2
│ ├── libdep3
│ ├── libdep4
│ └── libmylib
└── share
My ${CMAKE_BINARY_DIR}
looks like this:
build
├── build.ninja
├── rules.ninja
├── ...
└── src
├── apps
│ └── myprogram
└── libs
└── libmylib
And my portion of CMakeListst.txt
that sets up the bundling looks like this:
Bundle
set(BUNDLE_APPS "${CMAKE_BINARY_DIR}/src/apps/myprog")
set(BUNDLE_LIBS "${CMAKE_BINARY_DIR}/src/libs/libmylib.so")
set(BUNDLE_DIRS "${VTK_RUNTIME_LIBRARY_DIRS}" "${CMAKE_BINARY_DIR}/src/libs")
configure_file("${CMAKE_SOURCE_DIR}/cmake/bundle.cmake.in" "${CMAKE_BINARY_DIR}/bundle.cmake" @ONLY)
install(SCRIPT "${CMAKE_BINARY_DIR}/bundle.cmake")
This is the bundle.cmake.in
:
include(BundleUtilities)
fixup_bundle("@BUNDLE_APPS@" "@BUNDLE_LIBS@" "@BUNDLE_DIRS@")
This gives me the following error:
-- Analyzing app='[redacted]/build/src/apps/myprogram'
-- bundle='[redacted]/build/src/apps'
-- executable='[redacted]/build/src/apps/hgve'
-- valid='1'
-- executable file 1: [redacted]/build/src/apps/hgve
-- verified='0'
-- info='external prerequisites found:
f='/[redacted]/build/src/apps/hgve'
external_prereqs='[redacted]/build/src/libs/libMercurve.so'
'
The errors are quite cryptic…
I have some questions:
- Can I use
fixup_bundle
on a library? Or do I need an executable? - The
APPS
andLIBS
variables need to be in the${CMAKE_BINARY_DIR}
or${CMAKE_INSTALL_DIR}
? -
fixup_bundle
looks to put dependencies in the same directory as theAPP
executable. That means if I want to put the libs in thelib64
directory, I need to edit theRPATH
ofAPP
to point to the right path?