summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2020-06-05 13:46:48 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2020-06-08 18:25:51 +0200
commit2d9c9ab874e61dd9a5bc9830285cab6bb8a82cd3 (patch)
tree39fdee6a850b8caee6a1c7c46d7c95262a6da86c /cmake
parentb12f82018df21cb8a64726297020f0fbea6d8873 (diff)
CMake: Don't reset install prefix upon standalone test reconfiguration
CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT might be empty on the first configuration, but because QtBuildInternalsExtra sets the CMAKE_INSTALL_PREFIX, a second reconfiguration of a test would stop setting the fake install prefix. After some further consideration, there's no need to set the local fake prefix conditionally, we can always do it (unless explicitly opted out). This makes sure that a reconfiguration of a test doesn't suddenly install into the Qt prefix again. Amends 37b132cd4e081821ddc261d24abe8f914123547a Task-number: QTBUG-84346 Change-Id: Ic61aefe18418658455d8cdb9ebe6bcbcb8d67c99 Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuildInternals/QtBuildInternalsConfig.cmake16
1 files changed, 4 insertions, 12 deletions
diff --git a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
index 91275f5899..4e2704ec92 100644
--- a/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
+++ b/cmake/QtBuildInternals/QtBuildInternalsConfig.cmake
@@ -302,19 +302,11 @@ endfunction()
function(qt_set_up_fake_standalone_tests_install_prefix)
# Set a fake local (non-cache) CMAKE_INSTALL_PREFIX.
# Needed for standalone tests, we don't want to accidentally install a test into the Qt prefix.
- #
- # If CMAKE_INSTALL_PREFIX was default initialized, that means it points to something
- # like /usr/local which we don't want. Why? When metatype json files are created
- # during standalone tests configuration, the folder creation might fail due to missing
- # permissions in the /usr/local (which is the wrong place anyway).
- #
- # If the prefix was specified by the user at the command line, honor it, hoping that the
- # user knows what they are doing.
- if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
- set(new_install_prefix "${CMAKE_BINARY_DIR}/standalone_tests_fake_install_prefix")
- else()
- set(new_install_prefix "${QT_BACKUP_CMAKE_INSTALL_PREFIX_BEFORE_EXTRA_INCLUDE}")
+ # Allow opt-out, if a user knows what they're doing.
+ if(QT_NO_FAKE_STANDALONE_TESTS_INSTALL_PREFIX)
+ return()
endif()
+ set(new_install_prefix "${CMAKE_BINARY_DIR}/fake_prefix")
# It's IMPORTANT that this is not a cache variable. Otherwise
# qt_get_standalone_tests_confg_files_path() will not work on re-configuration.