How to use fixup_bundle properly?

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:

├── 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.

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

Is there a cleaner way to do this?

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

-- 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?

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?

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.

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

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?

I Never used it. Is jsoncpp already installed?

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

set(bundle "${CMAKE_INSTALL_PREFIX}/bin")
# ...
fixup_bundle("${bundle}" "${other_libs}" "${dirs}")
DESTDIR=../myporoject-bin cmake --install .

I got error:

--   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?

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).

Oh, okay. Thanks for your patience. :smile: