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.

Pick-to: 6.5
Task-number: QTBUG-113463
Change-Id: Ided141ed8de66cc1d3717ec2719eb703fa7fc589
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Amir Masoud Abdol 2023-05-09 14:37:33 +02:00
parent 7041d9dd75
commit 672a1d022c

View File

@ -1435,3 +1435,19 @@ function(qt_internal_run_common_config_tests)
qt_internal_check_cmp0099_available()
qt_configure_end_summary_section()
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()