From 5f1ed8da0eca3d2faeff6cde4da031b61f231dee Mon Sep 17 00:00:00 2001 From: Cristian Le Date: Fri, 28 Mar 2025 17:07:52 +0100 Subject: [PATCH] Move `qt_internal_project_setup` as early as possible The earliest we can move this is right after `BuildInternals`. This allows us to add function calls before navigating the `find_package` tree of the dependents. Task-number: QTBUG-135233 Change-Id: I6a875982fa6d8b15dcfacfda5e4d5976d02798d6 Reviewed-by: Alexandru Croitor Reviewed-by: Joerg Bornemann --- CMakeLists.txt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 073d55c8..a2b7fa3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,14 @@ project(QtGrpc set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE) -find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals Core) +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED COMPONENTS BuildInternals) + +# This should be called as early as possible, just after find_package(BuildInternals) where it is +# defined. +qt_internal_project_setup() + +find_package(Qt6 ${PROJECT_VERSION} CONFIG REQUIRED Core) + # Try to find Qt6::qtprotobufgen and Qt6::qtgrpcgen targets from host tools # when cross-compiling. if(NOT "${QT_HOST_PATH}" STREQUAL "") @@ -22,7 +29,6 @@ endif() find_package(Qt6 ${PROJECT_VERSION} CONFIG OPTIONAL_COMPONENTS Network Gui Widgets Quick QmlNetwork QuickControls2 QuickTest) -qt_internal_project_setup() include("${CMAKE_CURRENT_LIST_DIR}/src/tools/qtprotobufgen/Qt6ProtobufToolsMacros.cmake") include("${CMAKE_CURRENT_LIST_DIR}/src/tools/qtgrpcgen/Qt6GrpcToolsMacros.cmake")