CMake: Force Integrity to be a static Qt build

This was the case in Qt 5.15 as well.

The CMake toolchain file that Qt's CI is using is already setting
BUILD_SHARED_LIBS to OFF, but it's better to be explicit like we
are with WebAssembly and iOS.

Pick-to: 6.2
Change-Id: Ief17259c15690a97337e9df451663718601c2a52
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexandru Croitor 2021-07-14 11:55:59 +02:00
parent d79b3cbdd3
commit ba0d5ab555

View File

@ -5,6 +5,16 @@
# Make sure to not run detection when building standalone tests, because the detection was already
# done when initially configuring qtbase.
function(qt_internal_ensure_static_qt_config)
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Qt statically or dynamically" FORCE)
endif()
if(BUILD_SHARED_LIBS)
message(FATAL_ERROR
"Building Qt for ${CMAKE_SYSTEM_NAME} as shared libraries is not supported.")
endif()
endfunction()
function(qt_auto_detect_wasm)
if("${QT_QMAKE_TARGET_MKSPEC}" STREQUAL "wasm-emscripten" AND DEFINED ENV{EMSDK})
@ -49,14 +59,7 @@ function(qt_auto_detect_wasm)
endif()
set(QT_AUTODETECT_WASM TRUE CACHE BOOL "")
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Qt statically or dynamically" FORCE)
endif()
if(BUILD_SHARED_LIBS)
message(FATAL_ERROR
"Building Qt for ${CMAKE_SYSTEM_NAME} as shared libraries is not supported.")
endif()
qt_internal_ensure_static_qt_config()
# this version of Qt needs this version of emscripten
set(QT_EMCC_RECOMMENDED_VERSION 2.0.14 CACHE STRING INTERNAL FORCE)
endif()
@ -261,14 +264,7 @@ function(qt_auto_detect_ios)
endif()
set(CMAKE_OSX_ARCHITECTURES "${osx_architectures}" CACHE STRING "")
if(NOT DEFINED BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build Qt statically or dynamically" FORCE)
endif()
if(BUILD_SHARED_LIBS)
message(FATAL_ERROR
"Building Qt for ${CMAKE_SYSTEM_NAME} as shared libraries is not supported.")
endif()
qt_internal_ensure_static_qt_config()
# Disable qt rpaths for iOS, just like mkspecs/common/uikit.conf does, due to those
# bundles not being able to use paths outside the app bundle. Not sure this is strictly
@ -431,6 +427,17 @@ function(qt_auto_detect_win32_arm)
endif()
endfunction()
function(qt_auto_detect_integrity)
if(
# Qt's custom CMake toolchain file sets this value.
CMAKE_SYSTEM_NAME STREQUAL "Integrity" OR
# Upstream CMake expects this name, but we don't currently use it in Qt.
CMAKE_SYSTEM_NAME STREQUAL "GHS-MULTI"
)
qt_internal_ensure_static_qt_config()
endif()
endfunction()
qt_auto_detect_cmake_generator()
qt_auto_detect_cyclic_toolchain()
@ -443,3 +450,4 @@ qt_auto_detect_vcpkg()
qt_auto_detect_pch()
qt_auto_detect_wasm()
qt_auto_detect_win32_arm()
qt_auto_detect_integrity()