Skip to content

Commit

Permalink
Make sure that all dependencies are found before creating tool targets
Browse files Browse the repository at this point in the history
The result of dependency lookup is not taken into account when
evaluating tool packages. Check for <ToolPackage>_FOUND before creating
the tool targets that belong to the tool package. Adjust the tool package
lookup that the dependencies always affect the lookup result even if
we avoided creating targets by setting QT_NO_CREATE_TARGETS.

Pick-to: 6.5 6.5.0
Change-Id: Ia95c9c71370becc639ed8a9db026aed2f93959b4
Reviewed-by: Alexandru Croitor <[email protected]>
  • Loading branch information
semlanik committed Mar 13, 2023
1 parent 9f93f96 commit 5e4f481
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions cmake/QtModuleToolsConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ cmake_minimum_required(VERSION @min_new_policy_version@...@max_new_policy_versio

include(CMakeFindDependencyMacro)

if (NOT QT_NO_CREATE_TARGETS)
# Find required dependencies, if any.
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@[email protected]")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@[email protected]")
endif()
# Find required dependencies, if any.
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@[email protected]")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@[email protected]")
endif()

# If *Dependencies.cmake exists, the variable value will be defined there.
# Don't override it in that case.
if(NOT DEFINED "@INSTALL_CMAKE_NAMESPACE@@target@_FOUND")
set("@INSTALL_CMAKE_NAMESPACE@@target@_FOUND" TRUE)
endif()

if (NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target@_FOUND)
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@[email protected]")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@[email protected]")
if(NOT QT_NO_CREATE_VERSIONLESS_TARGETS)
Expand Down

0 comments on commit 5e4f481

Please sign in to comment.