CMake: Split 3rd party libs to be built before and after corelib

The ZLIB and the PCRE2 should be created before Core, because
src/corelib does qt_find_package to find the bundled / built
libraries.

The libpng, libjpeg, and the rest of the 3rd party libraries should be
created after the Core target is created, because they reference
Core conditionally in qt_internal_extend_target.

Targets should ideally be referenced only after they are created, when
creating linking relationships, but if code needs to extract
properties from those targets, then the targets must exist.
This will be the case in a future change which will extract the
package name from a target's property via qt_internal_extend_target ->
qt_register_target_dependencies chain.

Pick-to: 6.4
Task-number: QTBUG-104998
Change-Id: I732827e5bb4c88532c1e5261ef753d73bda6e638
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
Alexandru Croitor 2022-07-20 17:11:20 +02:00
parent 82a00471ac
commit d48e596b3c
2 changed files with 16 additions and 12 deletions

View File

@ -21,16 +21,6 @@ if(QT_FEATURE_gui AND QT_FEATURE_harfbuzz AND NOT QT_FEATURE_system_harfbuzz)
endif()
qt_install_3rdparty_library_wrap_config_extra_file(BundledHarfbuzz)
if(QT_FEATURE_regularexpression AND NOT QT_FEATURE_system_pcre2)
add_subdirectory(pcre2)
endif()
qt_install_3rdparty_library_wrap_config_extra_file(BundledPcre2)
if(NOT QT_FEATURE_system_zlib)
add_subdirectory(zlib)
endif()
qt_install_3rdparty_library_wrap_config_extra_file(BundledZLIB)
if (ANDROID)
add_subdirectory(gradle)
endif()

View File

@ -12,8 +12,6 @@ if(QT_FEATURE_gui)
qt_feature_evaluate_features("${CMAKE_CURRENT_SOURCE_DIR}/gui/configure.cmake")
endif()
add_subdirectory(3rdparty)
function(find_or_build_bootstrap_names)
if (QT_WILL_BUILD_TOOLS)
add_subdirectory(tools/bootstrap) # bootstrap library
@ -28,7 +26,23 @@ find_or_build_bootstrap_names()
add_subdirectory(entrypoint)
# These 3rd party libraries need to be built before corelib, because corelib
# does qt_find_package for them.
if(QT_FEATURE_regularexpression AND NOT QT_FEATURE_system_pcre2)
add_subdirectory(3rdparty/pcre2)
endif()
qt_install_3rdparty_library_wrap_config_extra_file(BundledPcre2)
if(NOT QT_FEATURE_system_zlib)
add_subdirectory(3rdparty/zlib)
endif()
qt_install_3rdparty_library_wrap_config_extra_file(BundledZLIB)
add_subdirectory(corelib)
# Needs to be after corelib, because some of them reference Core.
add_subdirectory(3rdparty)
if (QT_FEATURE_concurrent)
add_subdirectory(concurrent)
endif()