madduci
madduci

Reputation: 2893

CMake fixup_bundle for multiple executables

I'm running a project which has the following structure:

root/
---Applications/
   ---Application1/
   ---Application2/
---Modules/
   ---Library1/
   ---Library2/

So far, all the project creation and linking works fine on both Windows and Linux machines, using as dependences Qt5 and OpenCV. All the produced files should be copied in the final installation path:

INSTALL_DIR/
---bin/         #(for runtime)
---include/     #(for .h files)
---lib/         #(for lib files)

The problems start when I want to create a redistributable bundle. I've managed to create a script for each Application:

include("${CMAKE_ROOT}/Modules/BundleUtilities.cmake")     
fixup_bundle("@APPLICATION_PATH@" "@LIB_DEPS@" "@LIB_LOCS@")

In this way, unfortunately, fixup_bundle is called as many as the number of my applications is, and it takes long time, especially under Windows.

How can I create a unique installation script which performs only once the fixup_bundle?

Thanks in advance

Upvotes: 4

Views: 2234

Answers (1)

Praxeolitic
Praxeolitic

Reputation: 24099

I see the problem now.

It looks like this problem has been discussed on the CMake mailing list.

The OP there outlined this approach which was considered reasonable.

  1. Install all the common 3rdparty library dependencies somewhere out in /Library/Application Support.
  2. Install small wrapper scripts for both apps that set DYLD_LIBRARY_PATH to point to where the 3rdparty libs are installed, then launch the app.

The Kitware CMake wiki describes a similar approach in which shared libraries are installed as an OSX Framework.

http://www.cmake.org/Wiki/CMake:MacOSX_Frameworks

It states "Creating frameworks is just being started." but it also looks like it hasn't been updated in a while.

It looks like this simply isn't something that CMake easily does out of the box at the moment.

I did find an example of a CMakeLists.txt that installs an OSX Framework.

https://qt.gitorious.org/pyside/cgoncalves-apiextractor/source/d6568bba4798e05635c52ab4bd864dca9f828615:CMakeLists.txt#L176

Upvotes: 1

Related Questions