From 5059f7adc2abbfe6085a7b9dd04cd8463e1a412a Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 13 Apr 2022 15:07:46 +0200 Subject: CMake: An -extprefix -developer-build should install by default MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously if -extprefix /tmp/sysroot (CMAKE_STAGING_PREFIX) -developer-build (FEATURE_developer_build) were specified, but -prefix (CMAKE_INSTALL_PREFIX) was not, the build system would set the CMAKE_INSTALL_PREFIX to the qtbase build dir. Then, if targeting desktop, this would be considered a non-prefix build (ninja install would refuse to work), whereas in a cross-build it would be considered an installable build. In both cases though, the rpath of installed binaries would point to the qtbase build dir (because CMAKE_INSTALL_PREFIX would be set to the qtbase build dir). This is quite confusing behavior, in more than one way. Change the build system to consider that an explicit -extprefix should cause Qt to always be installed, even if -developer-build is specified. This means the installed rpaths and on-device install prefix (CMAKE_INSTALL_PREFIX) will now use the default computed install prefix, e.g. /usr/local/Qt It also means that to get a non-installable developer + custom staging and install (on-device) prefix build, users will have to be explicit and set all the options -extprefix ~/qt/qtbase_build_dir -prefix /usr -developer-build Pick-to: 6.2 6.3 Change-Id: Ib560452a4b4778860e0fd7666c76f8a6745773ee Reviewed-by: Jörg Bornemann --- cmake/QtSetup.cmake | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'cmake/QtSetup.cmake') diff --git a/cmake/QtSetup.cmake b/cmake/QtSetup.cmake index 85bd27a2da..ebcc4c408a 100644 --- a/cmake/QtSetup.cmake +++ b/cmake/QtSetup.cmake @@ -110,7 +110,8 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_LINK_DEPENDS_NO_SHARED ON) # Detect non-prefix builds: either when the qtbase install prefix is set to the binary dir -# or when a developer build is explicitly enabled and no install prefix is specified. +# or when a developer build is explicitly enabled and no install prefix (or staging prefix) +# is specified. # 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) @@ -118,8 +119,12 @@ if (PROJECT_NAME STREQUAL "QtBase" AND NOT QT_BUILD_STANDALONE_TESTS) # Handle both FEATURE_ and QT_FEATURE_ cases when they are specified on the command line # explicitly. It's possible for one to be set, but not the other, because # qtbase/configure.cmake is not processed by this point. - if(FEATURE_developer_build OR QT_FEATURE_developer_build - OR FEATURE_no_prefix OR QT_FEATURE_no_prefix) + if((FEATURE_developer_build + OR QT_FEATURE_developer_build + OR FEATURE_no_prefix + OR QT_FEATURE_no_prefix + ) + AND NOT CMAKE_STAGING_PREFIX) # 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. -- cgit v1.2.3