[CMake] Create Mac OS Bundle with VTK and Qt

Romain LEGUAY romain.leguay at gmail.com
Fri Sep 8 12:11:56 EDT 2017


Hello everyone,

Since this morning, I try to create a Bundle Application using CMake (3.9.1).

My application use VTK (8.x) and Qt (5.x). The find_package of those two libraries works greats (no problem to build and run the application).

I have many problems:

1) I try to add an icon without success.
2) I don’t know how (and where) to copy VTK dynamic libraries.
( Optional / not really related ) 3) When I try to use only some components of VTK, my application is linking to all VTK modules

I’m going to details each points:

1) For the icon issue, I proceed this way:

 
set(ICON_NAME "appIcon.icns") # I try without the icns extension without success.
set(ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/resources/icons/${ICON_NAME}")
set_source_files_properties("${ICON_PATH}" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)

add_executable(MYAPP MACOSX_BUNDLE ${ICON_PATH} ${other_sources})

set_target_properties(CRAFPACK_GUI PROPERTIES
		                    MACOSX_BUNDLE_ICON_FILE ${ICON_NAME})


The icon is copied inside the Resources folder of my bundle and the Info.plist is well updated (the CFBundleIconFile key is set to "appIcon.icns").

When I launch my app, the default icon is used and not my icon.


2) For the libraries of VTK I tried to use macdeployqt (found using find_program) but it doesn’t found the libraries (installed in a custom directories)

I tried to use BundleUtilities without any success (except to tell me that cmake doesn’t found the libraries).

I attach you my CMakeLists.

Is there a simple way to copy all found libraries/framework?

Thank you!

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CMakeLists.txt
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170908/71b45386/attachment.txt>


More information about the CMake mailing list