From d48e596b3ca07ed785a1bf7496fcc350590f6a54 Mon Sep 17 00:00:00 2001 From: Alexandru Croitor Date: Wed, 20 Jul 2022 17:11:20 +0200 Subject: [PATCH] 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 --- src/3rdparty/CMakeLists.txt | 10 ---------- src/CMakeLists.txt | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/3rdparty/CMakeLists.txt b/src/3rdparty/CMakeLists.txt index a02150e0f1..a597b47b52 100644 --- a/src/3rdparty/CMakeLists.txt +++ b/src/3rdparty/CMakeLists.txt @@ -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() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 62daf295e7..1c36da6022 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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()