summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@qt.io>2020-09-11 13:55:13 +0200
committerJoerg Bornemann <joerg.bornemann@qt.io>2020-09-12 19:26:55 +0200
commita3cb002511d7e2cc73234611795c1947620aedd5 (patch)
tree119cbdbc48a4694a817ee21bf4b799255fd3dd8f
parent58c1c6ee5c986d502b56eb1cc57f1d9444d42031 (diff)
CMake: Reduce the number of find_dependency calls
...in code. The actual number of calls at runtime does not change. The reason for this stunt is that we want to replace find_dependency with find_package at runtime for optional dependencies, and this will reduce the diff size of the next commit. Change-Id: I304fdf09c69fea7b6d4adabf515712eb097f8c86 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--cmake/QtConfigDependencies.cmake.in11
-rw-r--r--cmake/QtModuleDependencies.cmake.in7
-rw-r--r--cmake/QtPluginDependencies.cmake.in7
3 files changed, 11 insertions, 14 deletions
diff --git a/cmake/QtConfigDependencies.cmake.in b/cmake/QtConfigDependencies.cmake.in
index e16d725928..49e08b7ba6 100644
--- a/cmake/QtConfigDependencies.cmake.in
+++ b/cmake/QtConfigDependencies.cmake.in
@@ -11,6 +11,10 @@ foreach(_target_dep ${_third_party_deps})
if(version)
list(APPEND find_package_args "${version}")
endif()
+ if(components)
+ string(REPLACE " " ";" components "${components}")
+ list(APPEND find_package_args COMPONENTS ${components})
+ endif()
# Already build an error message, because find_dependency calls return() on failure.
set(__@INSTALL_CMAKE_NAMESPACE@_message "\nPackage: ${pkg}")
@@ -23,12 +27,7 @@ foreach(_target_dep ${_third_party_deps})
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE
"${__@INSTALL_CMAKE_NAMESPACE@_message}")
- if(components)
- string(REPLACE " " ";" components "${components}")
- find_dependency(${find_package_args} COMPONENTS ${components})
- else()
- find_dependency(${find_package_args})
- endif()
+ find_dependency(${find_package_args})
endforeach()
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND TRUE)
diff --git a/cmake/QtModuleDependencies.cmake.in b/cmake/QtModuleDependencies.cmake.in
index 80c5202c9a..3d19fac784 100644
--- a/cmake/QtModuleDependencies.cmake.in
+++ b/cmake/QtModuleDependencies.cmake.in
@@ -15,13 +15,12 @@ foreach(_target_dep ${_third_party_deps})
if(version)
list(APPEND find_package_args "${version}")
endif()
-
if(components)
string(REPLACE " " ";" components "${components}")
- find_dependency(${find_package_args} COMPONENTS ${components})
- else()
- find_dependency(${find_package_args})
+ list(APPEND find_package_args COMPONENTS ${components})
endif()
+
+ find_dependency(${find_package_args})
endforeach()
# Find Qt tool package.
diff --git a/cmake/QtPluginDependencies.cmake.in b/cmake/QtPluginDependencies.cmake.in
index ce64b096bb..bae6d85c7b 100644
--- a/cmake/QtPluginDependencies.cmake.in
+++ b/cmake/QtPluginDependencies.cmake.in
@@ -11,13 +11,12 @@ foreach(_target_dep ${_third_party_deps})
if(version)
list(APPEND find_package_args "${version}")
endif()
-
if(components)
string(REPLACE " " ";" components "${components}")
- find_dependency(${find_package_args} COMPONENTS ${components})
- else()
- find_dependency(${find_package_args})
+ list(APPEND find_package_args COMPONENTS ${components})
endif()
+
+ find_dependency(${find_package_args})
endforeach()
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"