CMake: Don't setup deployment when building Qt without examples

Introduce the variable QT_SKIP_SETUP_DEPLOYMENT to turn off the
generation of deployment support files. Set this variable when building
Qt - but only if we're not building examples.

This avoids a warning about missing patchelf when building Qt with CMake
< 3.21.

Change-Id: I8ff5491eb314ff870c210884fbf90dd4c9ad0219
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Joerg Bornemann 2022-11-29 14:40:25 +01:00
parent 34d7dd908e
commit 9204ac23a0
2 changed files with 9 additions and 0 deletions

View File

@ -354,3 +354,8 @@ to ${FEATURE_${feature}}")
Some features will be re-evaluated automatically.")
endif()
endif()
if(NOT QT_BUILD_EXAMPLES)
# Disable deployment setup to avoid warnings about missing patchelf with CMake < 3.21.
set(QT_SKIP_SETUP_DEPLOYMENT ON)
endif()

View File

@ -2410,6 +2410,10 @@ endfunction()
# Sets up the commands for use at install/deploy time
function(_qt_internal_setup_deploy_support)
if(QT_SKIP_SETUP_DEPLOYMENT)
return()
endif()
get_property(cmake_role GLOBAL PROPERTY CMAKE_ROLE)
if(NOT cmake_role STREQUAL "PROJECT")
return()