summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmir Masoud Abdol <amir.abdol@qt.io>2023-05-02 14:07:41 +0200
committerAmir Masoud Abdol <amir.abdol@qt.io>2023-05-03 19:44:45 +0200
commitedabd36cbbc97bd28de893a6f02a0ab5a79cb479 (patch)
tree5983fa0643996d4d3f58085c65de2a16d4480be8
parent4d404c2936627d98e996cb5750379438a084b53f (diff)
Introduce QT_ALLOW_SYMLINK_IN_PATHS flag
`QT_ALLOW_SYMLINK_IN_PATHS` disables the `qt_internal_check_if_path_has_symlinks` command. This allows people of Homebrew to get their build working without having to patch the entire function, as they currently do. Pick-to: 6.5 Change-Id: I4fed3ca497684364eaabbdbc44f1e148e3f28bd7 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
-rw-r--r--CMakeLists.txt25
-rw-r--r--cmake/QtSetup.cmake2
2 files changed, 22 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f4d7b44159..c774e297ab 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -38,11 +38,26 @@ function(qt_internal_check_if_path_has_symlinks path)
endwhile()
endif()
if(is_symlink)
- message(FATAL_ERROR "The path \"${path}\" contains symlinks. \
- This is not supported. Possible solutions:
- - map directories using a transparent mechanism such as mount --bind
- - pass the real path of the build directory to CMake, e.g. using \
- cd $(realpath <path>) before invoking cmake <source_dir>.")
+ set(possible_solutions_for_resolving_symlink [[
+ - Map directories using a transparent mechanism such as mount --bind
+ - Pass the real path of the build directory to CMake, e.g. using
+ cd $(realpath <path>) before invoking cmake <source_dir>.
+ ]])
+ if(QT_ALLOW_SYMLINK_IN_PATHS)
+ # In some cases, e.g., Homebrew, it is beneficial to skip this check.
+ # Before this, Homebrew had to patch this out to be able to get their build.
+ message(WARNING
+ "The path \"${path}\" contains symlinks. "
+ "This is not recommended, and it may lead to unexpected issues. If you do "
+ "not have a good reason for enabling 'QT_ALLOW_SYMLINK_IN_PATHS', disable "
+ "it, and follow one of the following solutions: \n"
+ "${possible_solutions_for_resolving_symlink} ")
+ else()
+ message(FATAL_ERROR
+ "The path \"${path}\" contains symlinks. "
+ "This is not supported. Possible solutions: \n"
+ "${possible_solutions_for_resolving_symlink} ")
+ endif()
endif()
endfunction()
qt_internal_check_if_path_has_symlinks("${CMAKE_BINARY_DIR}")
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
index 262b60d171..7efb1a3b06 100644
--- a/cmake/QtSetup.cmake
+++ b/cmake/QtSetup.cmake
@@ -352,6 +352,8 @@ if(QT_UNITY_BUILD)
set(CMAKE_UNITY_BUILD_BATCH_SIZE "${QT_UNITY_BUILD_BATCH_SIZE}")
endif()
+option(QT_ALLOW_SYMLINK_IN_PATHS "Allows symlinks in paths." OFF)
+
# We need to clean up QT_FEATURE_*, but only once per configuration cycle
get_property(qt_feature_clean GLOBAL PROPERTY _qt_feature_clean)
if(NOT qt_feature_clean)