# How to use fixup\_bundle for non-OSX targets for library and executable

**URL:** <https://discourse.cmake.org/t/how-to-use-fixup-bundle-for-non-osx-targets-for-library-and-executable/634>\
**Category:** Code\
**Tags:** os:linux\
**Created:** [February 13, 2020, 6:00pm UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-for-non-osx-targets-for-library-and-executable/634 "2020-02-13T18:00:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rdbisme](https://discourse.cmake.org/user_avatar/discourse.cmake.org/rdbisme/32/367_2.png) [@rdbisme](https://discourse.cmake.org/u/rdbisme)\
**Post date:** [February 13, 2020, 6:00pm UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-for-non-osx-targets-for-library-and-executable/634/1 "2020-02-13T18:00:57Z")

</div>

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:

```auto
root
├── bin
│ └── myprogram
├── lib64
│ ├── libdep1
│ ├── libdep2
│ ├── libdep3
│ ├── libdep4
│ └── libmylib
└── share

```

My `${CMAKE_BINARY_DIR}` looks like this:

```auto
build
├── build.ninja
├── rules.ninja
├── ...
└── src
    ├── apps
    │ └── myprogram
    └── libs
        └── libmylib

```

And my portion of `CMakeListst.txt` that sets up the bundling looks like this:

```auto
 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`:

```auto
include(BundleUtilities)

fixup_bundle("@BUNDLE_APPS@" "@BUNDLE_LIBS@" "@BUNDLE_DIRS@")

```

This gives me the following error:

```auto
-- 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:

1. Can I use `fixup_bundle` on a library? Or do I need an executable?
2. The `APPS` and `LIBS` variables need to be in the `${CMAKE_BINARY_DIR}` or `${CMAKE_INSTALL_DIR}`?
3. `fixup_bundle` looks to put dependencies in the same directory as the `APP` executable. That means if I want to put the libs in the `lib64` directory, I need to edit the `RPATH` of `APP` to point to the right path?
