[CMake] problems with DeployQt4 ?

James Sutherland James.Sutherland at utah.edu
Thu Jan 5 14:44:58 EST 2012


I am eager to use DeployQt4 because of the complexity of creating
applications.

This is a snippet of what I currently have:

-------------- <snip> ------------
  if( APPLE )
    set(GUI_TYPE MACOSX_BUNDLE)
    set( app_postfix ".app" )
    set( plugin_dest_dir bin/${appName}${app_postfix}/Contents/MacOS)
    set( qtconf_dest_dir bin/${appName}${app_postfix}/Contents/Resources)
    set( MACOSX_BUNDLE_ICON_FILE appIcon.icns )
    set_source_files_properties(
${CMAKE_CURRENT_SOURCE_DIR}/images/appIcon.icns PROPERTIES
MACOSX_PACKAGE_LOCATION Resource )
  endif()

  add_executable( ${appName} ${GUI_TYPE}
    ${util_src}
    ${gui_src}
    ${gui_headers}
    ${gui_headers_moc}
    ${gui_forms_headers}
    ${gui_resources_rcc}
    )

  target_link_libraries( ${appName} ${QT_LIBRARIES} )

  install( TARGETS ${appName} COMPONENT Runtime DESTINATION "bin" )

  include(CPack)
  include( InstallRequiredSystemLibraries )

  if( APPLE OR WIN32 )
    # must have CMAKE 2.8.7 or later
    string( COMPARE GREATER ${CMAKE_VERSION} 2.8.6 VERSION_OK )
    if( ${VERSION_OK} )
      include( DeployQt4 )  # requires cmake 2.8.7 or later
      set( PLUGINS qico;qtiff;qsvgicon )
      message( STATUS "QT PLUGINS: ${QTPLUGINS}" )
      install_qt4_executable( bin/${appName}${app_postfix} "${PLUGINS}" )
    endif()
  endif()
------------ </snip> ---------------

On my Mac, the install completes without errors, but the executable just
pops up a crash dialogue that doesn't mean anything to me.

One interesting observation is that the PLUGINS are not properly set in the
call to install_qt4_executable.  Output from cmake:

-- fixup_qt4_executable
--   executable='/Users/james/tmp/expr/bin/CreateExpr_1.0-0.app'
--   qtplugins=''
--   libs=''
--   dirs='/opt/local/lib'
--   plugins_dir=''
--   request_qt_conf=''
-- Writing
/Users/james/tmp/expr/bin/CreateExpr_1.0-0.app/Contents/Resources/qt.conf
-- fixup_bundle
--   app='/Users/james/tmp/expr/bin/CreateExpr_1.0-0.app'
--   libs=''
--   dirs='/opt/local/lib'


I am confused at why "qtplugins" is empty.  I have tried variations of how
I pass PLUGINS to the install_qt4_executable() function, but no joy.

Also, the "installed" app bundle has a few more things than the locally
built one, but is missing a Frameworks directory, for example.

Any ideas as to what I am doing wrong?

James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120105/539e4ffa/attachment.htm>


More information about the CMake mailing list