CMake: Fix user_facing_tool_links.txt for Apple platforms

User-facing apps that are app bundles on macOS weren't linked correctly.
For example, for Qt Designer we're creating now an entry like the
following:
    .../Designer.app/Contents/MacOS/Designer /usr/bin/designer6

Fixes: QTBUG-120487
Change-Id: I3eada15c4c5bf31b9b08829333d3c87f76ede7a2
Reviewed-by:  Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
(cherry picked from commit 2921a70e5d8de5bf3f4b56b90347983aa9b1342b)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit 06e9da856cae36eca2ab8c86390bba6fe620c37e)
This commit is contained in:
Joerg Bornemann 2024-01-02 21:11:59 +01:00 committed by Qt Cherry-pick Bot
parent af64fd6d6b
commit c1ef2ae813

View File

@ -837,8 +837,15 @@ function(qt_internal_generate_user_facing_tools_info)
if(NOT filename)
set(filename ${target})
endif()
set(linkname ${filename})
if(APPLE)
get_target_property(is_macos_bundle ${target} MACOSX_BUNDLE )
if(is_macos_bundle)
set(filename "${filename}.app/Contents/MacOS/${filename}")
endif()
endif()
qt_path_join(tool_target_path "${CMAKE_INSTALL_PREFIX}" "${INSTALL_BINDIR}" "${filename}")
qt_path_join(tool_link_path "${INSTALL_PUBLICBINDIR}" "${filename}${PROJECT_VERSION_MAJOR}")
qt_path_join(tool_link_path "${INSTALL_PUBLICBINDIR}" "${linkname}${PROJECT_VERSION_MAJOR}")
list(APPEND lines "${tool_target_path} ${tool_link_path}")
endforeach()
string(REPLACE ";" "\n" content "${lines}")