CMake: Fix returning early out of qdoc subdir when not building tools


If a top-level Qt is configured with QT_HOST_PATH to point to a
pre-built Qt to use its tools, we don't want to build any tools,
which includes qdoc.

This is implemented by calling
qt_internal_return_unless_building_tools right after a
qt_internal_add_tool call.

Over time, the qdoc CMakeLists.txt gained new code between those
calls, which now causes the build to break with:

 -- [QtTools] Tool 'Qt6::qdoc' was found at ~/qtbase/bin/qdoc.
 CMake Error at qtbase/cmake/QtResourceHelpers.cmake:6 (message):
   qdoc is not a target.
 Call Stack (most recent call first):
  qttools/src/qdoc/qdoc/CMakeLists.txt:242 (qt_internal_add_resource)

Move the qt_internal_return_unless_building_tools call to be
after the qt_internal_add_tool call again.

Pick-to: 6.12
Change-Id: I32a9e37fefc6c1788129b8695ebdfd103c144057
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
commit2064abee0c25e0226a0dc72b468e4df8618dc586
parent1beaf6f81ca5a309c7f8ea43d68f6586fa94009c
authorAlexandru Croitor <alexandru.croitor@qt.io>
committerAlexandru Croitor <alexandru.croitor@qt.io>
commit timeMon, 22 Jun 2026 10:05:09 +0000