Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9062851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T15:50:30+00:00 2026-06-16T15:50:30+00:00

I have a cross-platform application for the Win and Mac OSX platforms written in

  • 0

I have a cross-platform application for the Win and Mac OSX platforms written in C++, Qt and a little bit of Objective C. After a period of supporting two unrelated platform specific projects (VS 2010 and xCode) we decided to create a single CMake script. We generate a platform specific project and work with it.

After a pretty long delving I have managed to compile and link my application. But there are still plenty problems with creating a proper bundle (without any efforts xCode just creates a binary). After setting a few variables xCode compiles and creates a dummy bundle without a plist file and app’s executable. So I need to copy all required frameworks and resources to the bundle.

I’ve tried a few approaches to create a bundle. The first one was to use SET_SOURCE_FILES_PROPERTIES( ${resourcePath} PROPERTIES MACOSX_PACKAGE_LOCATION ${pathInsideBundle} ) and adding them (frameworks\resources) to ADD_EXECUTABLE like this: ADD_EXECUTABLE( FranchiseTracker MACOSX_BUNDLE ${headers} ${sources} ${form_headers} ${resources_rcc} ${thirdparty_sources} ${BUNDLE_COPY_RESOURCES} ). And it worked out – I’ve managed to copy an icon and the Sparkle framework to the bundle, but the problem was that I couldn’t copy the Qt frameworks, because FIND_PACKAGE left the ${QT_LIBRARIES} variable empty, so I couldn’t get the paths to copy frameworks “manually”.

Now I’m gonna use the “fix_bundle” approach because it promises me to copy all required resources without my intervention. So, here is my code related to fixup_bundle():

# Fixup bundle, copy dynamic libraries into app bundle
SET( EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/out )
SET( APPS "\${CMAKE_CURRENT_BINARY_DIR}/out/${APP_NAME}.app" ) # paths to executables
SET( DIRS "${CMAKE_SOURCE_DIR}/osx/FRP/vendors/libraries/lib" ) # directories to search for prerequisites
INSTALL( CODE "
    include(BundleUtilities)
    fixup_bundle(\"${APPS}\" \"\" \"${DIRS}\")
")

Now I’m stumped by a little refinement. The thing is stubborn xCode persists to generate and write my bundle in ${CMAKE_CURRENT_BINARY_DIR}/out/Debug and thus fixup_bundle can’t find any bundle at all.

My specific question (as in the title): How can I get the correct path (with Debug) in the CMake script? I wanna avoid to hardcode the path with Debug, because that will be wrong in a case of archiving.

My more common question: Is there an easier way of creating bundles for a Qt application with CMake? Maybe the whole my approach is wrong?

P.S. I have posted the full script to Code Review here.

P.P.S. For those who will consider my question as too verbose. The reason I’ve posted the full script and written my attempts (except I want to get it working) is that there is little info on the internet about working with Mac OSX frameworks, bundles, etc in CMake. I had to read a lot of mailing lists because I couldn’t find any structured tutorials or at least a decent documentation. And the only source to learn were other scripts written by other people. So I hope my script and explanations will help someone.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T15:50:31+00:00Added an answer on June 16, 2026 at 3:50 pm

    I’ve finished with using only the macdeployqt utility on the Mac OSX platform. I use xCode to build my application, so I’ve solved the path issue with xCode’s macros ${CONFIGURATION} like that:

    ....
    elseif( APPLE )
        ADD_EXECUTABLE( FranchiseTracker MACOSX_BUNDLE ${headers} ${sources} ${form_headers} ${resources_rcc} ${thirdparty_sources} ${BUNDLE_COPY_RESOURCES} )
        SET_TARGET_PROPERTIES( FranchiseTracker PROPERTIES OUTPUT_NAME ${APP_NAME} )
        SET_TARGET_PROPERTIES( FranchiseTracker PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/osx/FRP/info.plist") #or else you'll get an auto generated plist
    
        # Fixup bundle, copy dynamic libraries into app bundle
        ADD_CUSTOM_COMMAND( TARGET FranchiseTracker COMMAND macdeployqt ARGS ${CMAKE_CURRENT_BINARY_DIR}/\${CONFIGURATION}/${APP_NAME}.app ) # add -dmg for an image
    endif( WIN32 )
    

    Pay attention to escaping the $ character to prevent ${CONFIGURATION} from being expanded as a CMake variable.

    P.S. The code I’ve posted to CodeReview is a little bit outdated, so if anybody stumbles the same issue (with creating a bundle on OSX) and wants to see the full working variant, just let me know and I’ll post it somewhere (maybe update my post on CodeReview).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a new document-based cross-platform chemistry application (Win, Mac, Unix), which saves files
We have a cross platform application that is written in Java and built with
I have (in the past) written cross-platform (Windows/Unix) applications which, when started from the
I'm trying to develop a cross platform application. Currently I have set up following
I'm building an application, which is cross-platform (Linux, Win, OS X), and especially does
I have a very complex cross-platform application. Recently my team and I have been
I need an advice for cross-platform engine/framework for desktop PC application development (Windows, MAC,
I have the requirements to write a cross platform (win/linux) desktop applications. What database
I have a cross-platform application (game). It uses SDL library. I can't link it
I have a cross platform Qt application i'd like to add e-mail capabilities for.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.