summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2021-07-06 12:41:11 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2021-07-06 16:52:58 +0200
commit46d2ba1ea4d0e5f1a2ae1d1801e416e487ea45b4 (patch)
tree02206d2bef8a0f601cfa3a61397ca770137f9efc /cmake
parent4afcac9b7b2d35eb2e1347db68c57c99707ebfcc (diff)
Restore default installation prefix from Qt 5
Change the default installation prefix to C:/Qt/Qt-${version} on Windows and /usr/local/Qt-${version} elsewhere. This is what's expected by users coming from Qt5, and setting the installation prefix to "/usr/local" manually is easier than setting the versioned variant "/usr/local/Qt-6.2.0". [ChangeLog][Build System] The installation prefix now defaults to /usr/local/Qt-${version} and C:/Qt/Qt-${version} like it did in Qt 5. Fixes: QTBUG-91632 Pick-to: 6.2 Change-Id: I8ce57b1b18084c705b194c776e038cc807a6ed5e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtSetup.cmake23
1 files changed, 17 insertions, 6 deletions
diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake
index 30b3cbae67..17357dc1a4 100644
--- a/cmake/QtSetup.cmake
+++ b/cmake/QtSetup.cmake
@@ -65,13 +65,24 @@ set(CMAKE_LINK_DEPENDS_NO_SHARED ON)
# This detection only happens when building qtbase, and later is propagated via the generated
# QtBuildInternalsExtra.cmake file.
if (PROJECT_NAME STREQUAL "QtBase" AND NOT QT_BUILD_STANDALONE_TESTS)
- if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND FEATURE_developer_build)
- # Handle non-prefix builds by setting the CMake install prefix to point to qtbase's build
- # dir.
- # While building another repo (like qtsvg) the CMAKE_PREFIX_PATH
- # should be set on the command line to point to the qtbase build dir.
- set(CMAKE_INSTALL_PREFIX ${QtBase_BINARY_DIR} CACHE PATH
+ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
+ if(FEATURE_developer_build)
+ # Handle non-prefix builds by setting the CMake install prefix to point to qtbase's
+ # build dir. While building another repo (like qtsvg) the CMAKE_PREFIX_PATH should be
+ # set on the command line to point to the qtbase build dir.
+ set(__qt_default_prefix "${QtBase_BINARY_DIR}")
+ else()
+ if(CMAKE_HOST_WIN32)
+ set(__qt_default_prefix "C:/Qt/")
+ else()
+ set(__qt_default_prefix "/usr/local/")
+ endif()
+ string(APPEND __qt_default_prefix
+ "Qt-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")
+ endif()
+ set(CMAKE_INSTALL_PREFIX ${__qt_default_prefix} CACHE PATH
"Install path prefix, prepended onto install directories." FORCE)
+ unset(__qt_default_prefix)
endif()
if(CMAKE_CROSSCOMPILING)
set(__qt_prefix "${CMAKE_STAGING_PREFIX}")