Implement qt_internal_get_file_path_mode for changing the file path mode

In cases where we allow symlink, we need to use ABSOLUTE path, and don't
resolve the symlink. This function returns ABSOLUTE only if we are on
Apple platform, and have QT_ALLOW_SYMLINK_IN_PATHS enabled. While this
is mainly to resolve the issue report by Homebrew, it might be useful if
a user really want to build with symlink.

Task-number: QTBUG-113463
Change-Id: Ided141ed8de66cc1d3717ec2719eb703fa7fc589
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit 672a1d022c3aa36151c7b723b0c65e204980c202)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Amir Masoud Abdol 2023-05-09 14:37:33 +02:00 committed by Qt Cherry-pick Bot
parent 2140453785
commit 07fd20a0e1

View File

@ -1415,3 +1415,19 @@ function(qt_internal_run_common_config_tests)
qt_internal_check_cmp0099_available() qt_internal_check_cmp0099_available()
qt_configure_end_summary_section() qt_configure_end_summary_section()
endfunction() endfunction()
# It is used in QtWebEngine to replace the REALPATH with ABSOLUTE path, which is
# useful for building Qt in Homebrew.
function(qt_internal_get_filename_path_mode out_var)
set(mode REALPATH)
if(APPLE AND QT_ALLOW_SYMLINK_IN_PATHS)
set(mode ABSOLUTE)
message(WARNING
"QT_ALLOW_SYMLINK_IN_PATHS is enabled. "
"This is not recommended, and it may lead to unexpected issues. "
"E.g., When building QtWebEngine, enabling this option may result in build "
"issues in certain platforms. See https://bugreports.qt.io/browse/QTBUG-59769."
)
endif()
set(${out_var} ${mode} PARENT_SCOPE)
endfunction()