diff --git a/src/platform/qt/CMakeLists.txt b/src/platform/qt/CMakeLists.txt index 74e291db3..167e30b65 100644 --- a/src/platform/qt/CMakeLists.txt +++ b/src/platform/qt/CMakeLists.txt @@ -97,9 +97,16 @@ install(TARGETS ${BINARY_NAME}-qt if(APPLE OR WIN32) set_target_properties(${BINARY_NAME}-qt PROPERTIES OUTPUT_NAME ${PROJECT_NAME}) endif() -if(APPLE AND MACDEPLOYQT) - add_custom_command(TARGET ${BINARY_NAME}-qt POST_BUILD COMMAND ${MACDEPLOYQT} ${PROJECT_NAME}.app) - add_custom_command(TARGET ${BINARY_NAME}-qt POST_BUILD COMMAND rm -r ${PROJECT_NAME}.app/Contents/Plugins/bearer) - add_custom_command(TARGET ${BINARY_NAME}-qt POST_BUILD COMMAND rm -r ${PROJECT_NAME}.app/Contents/Plugins/imageformats) - add_custom_command(TARGET ${BINARY_NAME}-qt POST_BUILD COMMAND rm -r ${PROJECT_NAME}.app/Contents/Plugins/printsupport) +if(APPLE) + set(DEPLOY_OPTIONS -p platforms/libqcocoa.dylib,accessible/libqtaccessiblewidgets.dylib,audio/libqtaudio_coreaudio.dylib) + if(NOT CMAKE_INSTALL_NAME_TOOL EQUAL "install_name_tool") + set(DEPLOY_OPTIONS ${DEPLOY_OPTIONS} -I ${CMAKE_INSTALL_NAME_TOOL}) + endif() + if(DEFINED CMAKE_OTOOL AND NOT CMAKE_OTOOL EQUAL "otool") + set(DEPLOY_OPTIONS ${DEPLOY_OPTIONS} -O ${CMAKE_OTOOL}) + endif() + if(DEFINED CROSS_ROOT) + set(DEPLOY_OPTIONS ${DEPLOY_OPTIONS} -R ${CROSS_ROOT}) + endif() + add_custom_command(TARGET ${BINARY_NAME}-qt POST_BUILD COMMAND ${CMAKE_SOURCE_DIR}/tools/deploy-mac.py ${DEPLOY_OPTIONS} ${PROJECT_NAME}.app) endif()