diff options
author | Amir Masoud Abdol <amir.abdol@qt.io> | 2023-05-02 14:07:41 +0200 |
---|---|---|
committer | Amir Masoud Abdol <amir.abdol@qt.io> | 2023-05-03 19:44:45 +0200 |
commit | edabd36cbbc97bd28de893a6f02a0ab5a79cb479 (patch) | |
tree | 5983fa0643996d4d3f58085c65de2a16d4480be8 /CMakeLists.txt | |
parent | 4d404c2936627d98e996cb5750379438a084b53f (diff) | |
download | qtbase-edabd36cbbc97bd28de893a6f02a0ab5a79cb479.tar.gz |
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>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 25 |
1 files changed, 20 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}") |