Can't use fixup_bundle() to create a portable bundle with Qt

I added this line at the top of my CMakeLists.txt

set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})

And that was it.

By default, apparently, CMAKE_INSTALL_PREFIX is set to /usr/local on my machine. If changing it to my current working directory solved the issue, that means CMake was trying to perform some operations on /usr/local (which it is not allowed to do). So why the error message does not mention such a right access error?

I don't know if I haven't read enough documentation, or if the documentation needs some precisions...


In addition, I actually had to be even more explicit about the install path (i.e. within the .app).

Like this:

set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR})
install(CODE "
    include(BundleUtilities)
    fixup_bundle(${CMAKE_INSTALL_PREFIX}/MyApp.app \"\" \"\")
" COMPONENT Runtime)

(N.B. no separate SCRIPT but rather embedded CODE - shouldn't make a difference).

Tags:

C++

Qt

Cmake