diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-11-01 10:41:11 +0100 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2021-11-02 11:51:26 +0100 |
commit | f04dbdfc97f88260f312da325efd60170450671a (patch) | |
tree | ccbd6b3287e2ec7346509f03e3f3a1921d17d832 /cmake | |
parent | 25781a1396a9bebf8125e1989232d4d08d7c5160 (diff) |
CMake: Don't create targets if dependencies are not found
If one of the dependencies in QtFooModuleDependencies.cmake is not
found, QtFoo_FOUND will be set to False by find_dependency.
In that case, we should not create imported targets that belong to
that package.
It would be misleading for projects that do target existence checks
instead of package_FOUND checks as well as generally being
incorrect. The created imported targets might be referencing other
targets that would not exist.
Pick-to: 6.2
Fixes: QTBUG-97896
Change-Id: I09198aa3f19be047b27c29329b6e62c30fa09dc0
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Craig Scott <craig.scott@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtModuleConfig.cmake.in | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cmake/QtModuleConfig.cmake.in b/cmake/QtModuleConfig.cmake.in index 76fde2dc1f..76c918a774 100644 --- a/cmake/QtModuleConfig.cmake.in +++ b/cmake/QtModuleConfig.cmake.in @@ -22,7 +22,7 @@ if(NOT DEFINED "@INSTALL_CMAKE_NAMESPACE@@target@_FOUND") set("@INSTALL_CMAKE_NAMESPACE@@target@_FOUND" TRUE) endif() -if (NOT QT_NO_CREATE_TARGETS) +if (NOT QT_NO_CREATE_TARGETS AND @INSTALL_CMAKE_NAMESPACE@@target@_FOUND) include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Targets.cmake") include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@AdditionalTargetInfo.cmake") if(NOT QT_NO_CREATE_VERSIONLESS_TARGETS) |