[CMake] Create package for specific application bundle

Martin Percossi mpercossi at zenaud.io
Fri May 8 11:16:00 EDT 2015


Hello,

My situation is as follows. I'm creating an OSX application with
MACOSX_BUNDLE for my main target. In addition, my project creates a helper
application (also a bundle), and this is copied into the PlugIns directory
of the main target using an INSTALL command. So my CMake project contains
two subdirectories, one for the "application" target, and one for the
"helper" target.

So far, so good. The problem is that now I want to package this. For now,
I'm using a simple tar.gz package generator, although I'd also like to
package to a .dmg or installer (not sure which yet). The default package
command, of course, packages the "helper" app _next to_ the application in
the tarball -- this is not what I want, since I have already packaged the
helper app into the main applications app bundle.

I've tried using components, by setting the INSTALL commands for the helper
to "helper_component", and the commands for the main application to
"application_component", and then specifying that I only want a package for
application_component via *CPACK_COMPONENTS_ALL. *Unfortunately, that still
packages both.

I've also tried the approach of creating separate sub-projects for each of
the application and helper targets, and attempting:

set(CPACK_INSTALL_CMAKE_PROJECTS
    "${CMAKE_INSTALL_PREFIX}"
    "application"
    "ALL"
    "/"
)
include(CPack)

in the top-level CMakeLists.txt. In this case, CPack fails entirely to
create a package:

CPack: Create package using STGZ
CPack: Install projects
CPack: - Run preinstall target for: application
CPack Error: Problem running install command: "/usr/bin/make" "preinstall"
Please check
/Users/mpercossi/zenAud.io/src/zenAud.io/build/ninja/_CPack_Packages/Darwin/STGZ/PreinstallOutput.log
for errors
CPack Error: Error when generating package: zenAud.io
make: *** [package] Error 1

Surely what I'm trying to do is reasonably typical? I simply want to
exclude a target (and associated INSTALL commands) from packaging. Could
someone point me to the correct approach, whether with COMPONENT
declarations for the INSTALL commands, or subprojects?

Kind regards,

Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150508/fc18bb3e/attachment-0001.html>


More information about the CMake mailing list