CMake: Fix -no-prefix build with CMake < 3.26 on macOS
On macOS, Core has plugins that link against CorePrivate. In a non-prefix build, user projects failed on find_package(Qt6 REQUIRED COMPONENTS Core), because CorePrivate is required for these plugins in a non-prefix build, but it's not automatically pulled in. This is only an issue for CMake < 3.26, because these older CMake versions lack the BUILD_LOCAL_INTERFACE generator expression. Fix this by pulling in the private modules for non-prefix builds when using CMake < 3.26. Also, issue a warning in this situation. Fixes: QTBUG-134407 Change-Id: I7f182c9518686390e657663b452cad8101d870a2 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
ba103a6fee
commit
9df20860de
@ -1034,12 +1034,15 @@ function(qt_internal_write_basic_module_package target target_private)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(arg_IS_STATIC_LIB AND NOT arg_PRIVATE AND CMAKE_VERSION VERSION_LESS "3.26")
|
||||
# We auto-load the private module package from the public module package if we have a static
|
||||
# Qt module and CMake's version is < 3.26. This is needed for the case "Qt6Foo links against
|
||||
# Qt6BarPrivate", because CMake generates a check for the target Qt6::BarPrivate in
|
||||
# Qt6FooTargets.cmake. Once we can require CMake 3.26, we can simply link against
|
||||
# $<BUILD_LOCAL_INTERFACE:Qt6BarPrivate> in qt_internal_extend_target.
|
||||
if((QT_FEATURE_no_prefix OR arg_IS_STATIC_LIB)
|
||||
AND NOT arg_PRIVATE
|
||||
AND CMAKE_VERSION VERSION_LESS "3.26")
|
||||
# We auto-load the private module package from the public module package if we have a
|
||||
# statically built module or a non-prefix build and CMake's version is < 3.26. This is
|
||||
# needed for the case "Qt6Foo links against Qt6BarPrivate", because CMake generates a check
|
||||
# for the target Qt6::BarPrivate in Qt6FooTargets.cmake. Once we can require CMake 3.26, we
|
||||
# can simply link against $<BUILD_LOCAL_INTERFACE:Qt6BarPrivate> in
|
||||
# qt_internal_extend_target.
|
||||
#
|
||||
# For older CMake versions, we create an additional CMake file that's optionally included by
|
||||
# Qt6FooConfig.cmake to work around the lack of BUILD_LOCAL_INTERFACE.
|
||||
|
@ -1526,3 +1526,11 @@ qt_feature_definition("test_gui" "QT_GUI_TEST" VALUE "1")
|
||||
qt_feature("test_gui" PUBLIC
|
||||
LABEL "Build QtGuiTest namespace"
|
||||
)
|
||||
|
||||
qt_configure_add_report_entry(
|
||||
TYPE WARNING
|
||||
MESSAGE "Starting with Qt 6.10, a -no-prefix or -developer-build
|
||||
Qt build might not find all necessary Qt packages when using CMake < 3.26.
|
||||
Please use a newer CMake version."
|
||||
CONDITION QT_FEATURE_no_prefix AND CMAKE_VERSION VERSION_LESS "3.26"
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user