# How to use fixup\_bundle properly?

**URL:** https://discourse.cmake.org/t/how-to-use-fixup-bundle-properly/11128
**Category:** Code
**Created:** [June 29, 2024, 3:25am UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-properly/11128 "2024-06-29T03:25:55Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![ikspress](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/i/ac8455/32.png) [@ikspress](https://discourse.cmake.org/u/ikspress)
#### Post date: [June 29, 2024, 3:25am UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-properly/11128/1 "2024-06-29T03:25:56Z")

</div>

I’m a new to CMake, please forgive me if my post bother you. I attempted to write a CMake project with `BundleUtilities`, but there some doubts that bother me.

My project install directory like this:

```auto
.
├── bin
│ ├── myprog1.exe
│ ├── myprog2.exe
│ ├── myprog3.exe
│ ├── myprog4.exe
│ ├── myprog5.exe
├── include
│ └── ...
├── lib
│ ├── cmake
│ │ └── MyTestProjectConfig.cmake
│ └── pkgconfig
│ └── mytestproject.pc
└── share
    └── man
        └── ...

```

First, I tried to fix dependency for the programs in `bin/` directory.

```auto
# FixBundle.cmake
set(APPS "myprog1.exe" "myprog2.exe" "myprog3.exe" ...)
# ...
foreach(APP "${APPS}")
    fixup_bundle("${APP}" "${other_libs}" "${dirs}")
endforeach(app)

```

Is there a cleaner way to do this?

And then, I typed `DESTDIR=../myporoject-bin cmake --install .` after `cmake --build .`  
But it failed.

```auto
-- warning: *NOT* handled - directory/file does not exist...
CMake Error at C:/msys64/mingw64/share/cmake/Modules/BundleUtilities.cmake:996 (message):
  error: fixup_bundle: not a valid bundle

```

How to `fixup_bundle` work with `DESTDIR`?

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 29, 2024, 9:51am UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-properly/11128/2 "2024-06-29T09:51:58Z")

</div>

> [@ikspress](#):
>
> `BundleUtilities`

A collection of CMake utility functions useful for dealing with `.app` bundles on the Mac and bundle-like directories on any OS.

Why do you use this on windows?

What do you really want to do?

Dit you read [How to cpack dependent shared libraries along with my executable?](https://discourse.cmake.org/t/how-to-cpack-dependent-shared-libraries-along-with-my-executable/267)

---

<div class="post-metadata">

### Author: ![ikspress](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/i/ac8455/32.png) [@ikspress](https://discourse.cmake.org/u/ikspress)
#### Post date: [June 30, 2024, 2:00pm UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-properly/11128/3 "2024-06-30T14:00:45Z")

</div>

> Why do you use this on windows?

Is it only for Mac?

> What do you really want to do?

I just want to assemble a standalone application.

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 30, 2024, 2:17pm UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-properly/11128/4 "2024-06-30T14:17:18Z")

</div>

That is easy of it is static linked.  
Just install(TARGETS …)

---

<div class="post-metadata">

### Author: ![ikspress](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/i/ac8455/32.png) [@ikspress](https://discourse.cmake.org/u/ikspress)
#### Post date: [June 30, 2024, 2:31pm UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-properly/11128/5 "2024-06-30T14:31:56Z")

</div>

Oops, may I forgot to notice it. My programs in `bin/` depends on `libstdc++` `jsoncpp` etc and are not staticially linked. Is `BundleUtilities` inappropriate on Windows?

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [June 30, 2024, 2:58pm UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-properly/11128/6 "2024-06-30T14:58:26Z")

</div>

I Never used it. Is jsoncpp already installed?

---

<div class="post-metadata">

### Author: ![ikspress](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/i/ac8455/32.png) [@ikspress](https://discourse.cmake.org/u/ikspress)
#### Post date: [July 1, 2024, 8:05am UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-properly/11128/7 "2024-07-01T08:05:15Z")

</div>

Sorry for my late reply.  
Yes, I had already installed the dependencies. But the previous troubles remain.  
Here are some snippet:

```cmake
set(bundle "${CMAKE_INSTALL_PREFIX}/bin")
# ...
fixup_bundle("${bundle}" "${other_libs}" "${dirs}")

```

```bash
DESTDIR=../myporoject-bin cmake --install .

```

I got error:

```plaintext
-- app='D:/myporoject-bin/mingw64/bin'
-- libs=''
-- dirs='C:/msys64/mingw64/bin'
-- ignoreItems=''
-- warning: *NOT* handled - directory but not .app case...

```

How can I fix it?

---

<div class="post-metadata">

### Author: ![ClausKlein](https://discourse.cmake.org/user_avatar/discourse.cmake.org/clausklein/32/352_2.png) [@ClausKlein](https://discourse.cmake.org/u/ClausKlein)
#### Post date: [July 1, 2024, 8:48am UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-properly/11128/8 "2024-07-01T08:48:09Z")

</div>

Forget the bundle!

If your dependency are right installed, your executables build project should find it.  
Then you neet only to install the executables (and check the path to find the runtime dependencies).

---

<div class="post-metadata">

### Author: ![ikspress](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/i/ac8455/32.png) [@ikspress](https://discourse.cmake.org/u/ikspress)
#### Post date: [July 1, 2024, 9:13am UTC](https://discourse.cmake.org/t/how-to-use-fixup-bundle-properly/11128/9 "2024-07-01T09:13:26Z")

</div>

Oh, okay. Thanks for your patience. 😄
