summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Xinwei <1326710505@qq.com>2021-07-23 15:37:14 +0800
committerLi Xinwei <1326710505@qq.com>2021-07-24 03:51:53 +0800
commitbd594f945773f713ca493fd7b040fde8a12bdf87 (patch)
treebd59260f6544266d0c1523893e113248f36261fc
parent1ae4c56cebf2f4329b9f9082831d46ffa1840635 (diff)
CMake: Use namespaced variables in Qt6*Dependencies.cmake
Pick-to: 6.2 6.1 Change-Id: I166988020cfd9750a4d58e519742215d0c03ad3e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
-rw-r--r--cmake/QtConfigDependencies.cmake.in57
-rw-r--r--cmake/QtModuleDependencies.cmake.in64
-rw-r--r--cmake/QtModuleToolsDependencies.cmake.in12
-rw-r--r--cmake/QtPluginDependencies.cmake.in46
-rw-r--r--cmake/QtPublicDependencyHelpers.cmake18
5 files changed, 98 insertions, 99 deletions
diff --git a/cmake/QtConfigDependencies.cmake.in b/cmake/QtConfigDependencies.cmake.in
index 159d3c020c..b23b6681eb 100644
--- a/cmake/QtConfigDependencies.cmake.in
+++ b/cmake/QtConfigDependencies.cmake.in
@@ -1,50 +1,49 @@
set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCIES_FOUND FALSE)
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
-set(_third_party_deps "@third_party_deps@")
+set(__qt_third_party_deps "@third_party_deps@")
@third_party_extra@
-foreach(_target_dep ${_third_party_deps})
- list(GET _target_dep 0 pkg)
- list(GET _target_dep 1 is_optional)
- list(GET _target_dep 2 version)
- list(GET _target_dep 3 components)
- list(GET _target_dep 4 optional_components)
- set(find_package_args "${pkg}")
- if(version)
- list(APPEND find_package_args "${version}")
+foreach(__qt_target_dep ${__qt_third_party_deps})
+ list(GET __qt_target_dep 0 __qt_pkg)
+ list(GET __qt_target_dep 1 __qt_is_optional)
+ list(GET __qt_target_dep 2 __qt_version)
+ list(GET __qt_target_dep 3 __qt_components)
+ list(GET __qt_target_dep 4 __qt_optional_components)
+ set(__qt_find_package_args "${__qt_pkg}")
+ if(__qt_version)
+ list(APPEND __qt_find_package_args "${__qt_version}")
endif()
- if(components)
- string(REPLACE " " ";" components "${components}")
- list(APPEND find_package_args COMPONENTS ${components})
+ if(__qt_components)
+ string(REPLACE " " ";" __qt_components "${__qt_components}")
+ list(APPEND __qt_find_package_args COMPONENTS ${__qt_components})
endif()
- if(optional_components)
- string(REPLACE " " ";" optional_components "${optional_components}")
- list(APPEND find_package_args OPTIONAL_COMPONENTS ${optional_components})
+ if(__qt_optional_components)
+ string(REPLACE " " ";" __qt_optional_components "${__qt_optional_components}")
+ list(APPEND __qt_find_package_args OPTIONAL_COMPONENTS ${__qt_optional_components})
endif()
# Already build an error message, because find_dependency calls return() on failure.
- set(__@INSTALL_CMAKE_NAMESPACE@_message "\nPackage: ${pkg}")
- if(version)
- string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nVersion: ${version}")
+ set(__qt_message "\nPackage: ${__qt_pkg}")
+ if(__qt_version)
+ string(APPEND __qt_message "\nVersion: ${__qt_version}")
endif()
- if(components)
- string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nComponents: ${components}")
+ if(__qt_components)
+ string(APPEND __qt_message "\nComponents: ${__qt_components}")
endif()
- if(optional_components)
- string(APPEND __@INSTALL_CMAKE_NAMESPACE@_message "\nComponents: ${optional_components}")
+ if(__qt_optional_components)
+ string(APPEND __qt_message "\nComponents: ${__qt_optional_components}")
endif()
- set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE
- "${__@INSTALL_CMAKE_NAMESPACE@_message}")
+ set(@INSTALL_CMAKE_NAMESPACE@_DEPENDENCY_NOT_FOUND_MESSAGE "${__qt_message}")
- if(is_optional)
+ if(__qt_is_optional)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
- list(APPEND find_package_args QUIET)
+ list(APPEND __qt_find_package_args QUIET)
endif()
- find_package(${find_package_args})
+ find_package(${__qt_find_package_args})
else()
- find_dependency(${find_package_args})
+ find_dependency(${__qt_find_package_args})
endif()
endforeach()
diff --git a/cmake/QtModuleDependencies.cmake.in b/cmake/QtModuleDependencies.cmake.in
index b31cef1dda..7f0f00fdf5 100644
--- a/cmake/QtModuleDependencies.cmake.in
+++ b/cmake/QtModuleDependencies.cmake.in
@@ -15,39 +15,39 @@ find_dependency(@INSTALL_CMAKE_NAMESPACE@ @PROJECT_VERSION@
)
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
-set(_third_party_deps "@third_party_deps@")
+set(__qt_@target@_third_party_deps "@third_party_deps@")
-foreach(_target_dep ${_third_party_deps})
- list(GET _target_dep 0 pkg)
- list(GET _target_dep 1 is_optional)
- list(GET _target_dep 2 version)
- list(GET _target_dep 3 components)
- list(GET _target_dep 4 optional_components)
- set(find_package_args "${pkg}")
- if(version)
- list(APPEND find_package_args "${version}")
+foreach(__qt_@target@_target_dep ${__qt_@target@_third_party_deps})
+ list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
+ list(GET __qt_@target@_target_dep 1 __qt_@target@_is_optional)
+ list(GET __qt_@target@_target_dep 2 __qt_@target@_version)
+ list(GET __qt_@target@_target_dep 3 __qt_@target@_components)
+ list(GET __qt_@target@_target_dep 4 __qt_@target@_optional_components)
+ set(__qt_@target@_find_package_args "${__qt_@target@_pkg}")
+ if(__qt_@target@_version)
+ list(APPEND __qt_@target@_find_package_args "${__qt_@target@_version}")
endif()
- if(components)
- string(REPLACE " " ";" components "${components}")
- list(APPEND find_package_args COMPONENTS ${components})
+ if(__qt_@target@_components)
+ string(REPLACE " " ";" __qt_@target@_components "${__qt_@target@_components}")
+ list(APPEND __qt_@target@_find_package_args COMPONENTS ${__qt_@target@_components})
endif()
- if(optional_components)
- string(REPLACE " " ";" optional_components "${optional_components}")
- list(APPEND find_package_args OPTIONAL_COMPONENTS ${optional_components})
+ if(__qt_@target@_optional_components)
+ string(REPLACE " " ";" __qt_@target@_optional_components "${__qt_@target@_optional_components}")
+ list(APPEND __qt_@target@_find_package_args OPTIONAL_COMPONENTS ${__qt_@target@_optional_components})
endif()
- if(is_optional)
+ if(__qt_@target@_is_optional)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
- list(APPEND find_package_args QUIET)
+ list(APPEND __qt_@target@_find_package_args QUIET)
endif()
- find_package(${find_package_args})
+ find_package(${__qt_@target@_find_package_args})
else()
- find_dependency(${find_package_args})
+ find_dependency(${__qt_@target@_find_package_args})
endif()
endforeach()
# Find Qt tool package.
-set(_tool_deps "@main_module_tool_deps@")
+set(__qt_@target@_tool_deps "@main_module_tool_deps@")
if(NOT "${QT_HOST_PATH}" STREQUAL "")
# Make sure that the tools find the host tools first
@@ -57,23 +57,23 @@ if(NOT "${QT_HOST_PATH}" STREQUAL "")
list(PREPEND CMAKE_FIND_ROOT_PATH "${QT_HOST_PATH}")
endif()
-foreach(_target_dep ${_tool_deps})
- list(GET _target_dep 0 pkg)
- list(GET _target_dep 1 version)
+foreach(__qt_@target@_target_dep ${__qt_@target@_tool_deps})
+ list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
+ list(GET __qt_@target@_target_dep 1 __qt_@target@_version)
- unset(find_package_args)
+ unset(__qt_@target@_find_package_args)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
- list(APPEND find_package_args QUIET)
+ list(APPEND __qt_@target@_find_package_args QUIET)
endif()
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
- list(APPEND find_package_args REQUIRED)
+ list(APPEND __qt_@target@_find_package_args REQUIRED)
endif()
- find_package(${pkg} ${version} ${find_package_args}
+ find_package(${__qt_@target@_pkg} ${__qt_@target@_version} ${__qt_@target@_find_package_args}
PATHS
${_qt_additional_packages_prefix_path}
${_qt_additional_packages_prefix_path_env}
)
- if (NOT ${pkg}_FOUND)
+ if (NOT ${__qt_@target@_pkg}_FOUND)
if(NOT "${QT_HOST_PATH}" STREQUAL "")
set(CMAKE_PREFIX_PATH ${BACKUP_@target@_CMAKE_PREFIX_PATH})
set(CMAKE_FIND_ROOT_PATH ${BACKUP_@target@_CMAKE_FIND_ROOT_PATH})
@@ -87,9 +87,9 @@ if(NOT "${QT_HOST_PATH}" STREQUAL "")
endif()
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
-set(_@target@_target_deps "@target_deps@")
-set(_@target@_find_dependency_paths "${CMAKE_CURRENT_LIST_DIR}/..")
-_qt_internal_find_dependencies(_@target@_target_deps _@target@_find_dependency_paths)
+set(__qt_@target@_target_deps "@target_deps@")
+set(__qt_@target@_find_dependency_paths "${CMAKE_CURRENT_LIST_DIR}/..")
+_qt_internal_find_dependencies(__qt_@target@_target_deps __qt_@target@_find_dependency_paths)
set(_@QT_CMAKE_EXPORT_NAMESPACE@@target@_MODULE_DEPENDENCIES "@qt_module_dependencies@")
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND TRUE)
diff --git a/cmake/QtModuleToolsDependencies.cmake.in b/cmake/QtModuleToolsDependencies.cmake.in
index d9ff04b6f9..2eaaf74976 100644
--- a/cmake/QtModuleToolsDependencies.cmake.in
+++ b/cmake/QtModuleToolsDependencies.cmake.in
@@ -1,12 +1,12 @@
# Find "ModuleTools" dependencies, which are other ModuleTools packages.
set(@INSTALL_CMAKE_NAMESPACE@@target@_FOUND FALSE)
-set(_tool_deps "@package_deps@")
-foreach(_target_dep ${_tool_deps})
- list(GET _target_dep 0 pkg)
- list(GET _target_dep 1 version)
+set(__qt_@target@_tool_deps "@package_deps@")
+foreach(__qt_@target@_target_dep ${__qt_@target@_tool_deps})
+ list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
+ list(GET __qt_@target@_target_dep 1 __qt_@target@_version)
- if (NOT ${pkg}_FOUND)
- find_dependency(${pkg} ${version})
+ if (NOT ${__qt_@target@_pkg}_FOUND)
+ find_dependency(${__qt_@target@_pkg} ${__qt_@target@_version})
endif()
endforeach()
diff --git a/cmake/QtPluginDependencies.cmake.in b/cmake/QtPluginDependencies.cmake.in
index 7dde52ba6a..81b66837f0 100644
--- a/cmake/QtPluginDependencies.cmake.in
+++ b/cmake/QtPluginDependencies.cmake.in
@@ -1,34 +1,34 @@
set(@target@_FOUND FALSE)
# note: _third_party_deps example: "ICU\\;FALSE\\;1.0\\;i18n uc data;ZLIB\\;FALSE\\;\\;"
-set(_third_party_deps "@third_party_deps@")
+set(__qt_@target@_third_party_deps "@third_party_deps@")
-foreach(_target_dep ${_third_party_deps})
- list(GET _target_dep 0 pkg)
- list(GET _target_dep 1 is_optional)
- list(GET _target_dep 2 version)
- list(GET _target_dep 3 components)
- list(GET _target_dep 4 optional_components)
- set(find_package_args "${pkg}")
- if(version)
- list(APPEND find_package_args "${version}")
+foreach(__qt_@target@_target_dep ${__qt_@target@_third_party_deps})
+ list(GET __qt_@target@_target_dep 0 __qt_@target@_pkg)
+ list(GET __qt_@target@_target_dep 1 __qt_@target@_is_optional)
+ list(GET __qt_@target@_target_dep 2 __qt_@target@_version)
+ list(GET __qt_@target@_target_dep 3 __qt_@target@_components)
+ list(GET __qt_@target@_target_dep 4 __qt_@target@_optional_components)
+ set(__qt_@target@_find_package_args "${__qt_@target@_pkg}")
+ if(__qt_@target@_version)
+ list(APPEND __qt_@target@_find_package_args "${__qt_@target@_version}")
endif()
- if(components)
- string(REPLACE " " ";" components "${components}")
- list(APPEND find_package_args COMPONENTS ${components})
+ if(__qt_@target@_components)
+ string(REPLACE " " ";" __qt_@target@_components "${__qt_@target@_components}")
+ list(APPEND __qt_@target@_find_package_args COMPONENTS ${__qt_@target@_components})
endif()
- if(optional_components)
- string(REPLACE " " ";" optional_components "${optional_components}")
- list(APPEND find_package_args OPTIONAL_COMPONENTS ${optional_components})
+ if(__qt_@target@_optional_components)
+ string(REPLACE " " ";" __qt_@target@_optional_components "${__qt_@target@_optional_components}")
+ list(APPEND __qt_@target@_find_package_args OPTIONAL_COMPONENTS ${__qt_@target@_optional_components})
endif()
- if(is_optional)
+ if(__qt_@target@_is_optional)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
- list(APPEND find_package_args QUIET)
+ list(APPEND __qt_@target@_find_package_args QUIET)
endif()
- find_package(${find_package_args})
+ find_package(${__qt_@target@_find_package_args})
else()
- find_dependency(${find_package_args})
+ find_dependency(${__qt_@target@_find_package_args})
endif()
endforeach()
@@ -38,8 +38,8 @@ if(QT_DISABLE_NO_DEFAULT_PATH_IN_QT_PACKAGES)
endif()
# note: target_deps example: "Qt6Core\;5.12.0;Qt6Gui\;5.12.0"
-set(_@target@_target_deps "@target_deps@")
-set(_@target@_find_dependency_paths "@find_dependency_paths@")
-_qt_internal_find_dependencies(_@target@_target_deps _@target@_find_dependency_paths)
+set(__qt_@target@_target_deps "@target_deps@")
+set(__qt_@target@_find_dependency_paths "@find_dependency_paths@")
+_qt_internal_find_dependencies(__qt_@target@_target_deps __qt_@target@_find_dependency_paths)
set(@target@_FOUND TRUE)
diff --git a/cmake/QtPublicDependencyHelpers.cmake b/cmake/QtPublicDependencyHelpers.cmake
index e5e41b92af..84c9e8be92 100644
--- a/cmake/QtPublicDependencyHelpers.cmake
+++ b/cmake/QtPublicDependencyHelpers.cmake
@@ -2,18 +2,18 @@
# contain preformed dependencies. See foreach block for reference.
# The same applies for find_dependency_path_list.
macro(_qt_internal_find_dependencies target_dep_list find_dependency_path_list)
- foreach(target_dep IN LISTS ${target_dep_list})
- list(GET target_dep 0 pkg)
- list(GET target_dep 1 version)
+ foreach(__qt_target_dep IN LISTS ${target_dep_list})
+ list(GET __qt_target_dep 0 __qt_pkg)
+ list(GET __qt_target_dep 1 __qt_version)
- if (NOT ${pkg}_FOUND)
- set(pkg_names ${pkg})
- if(pkg MATCHES "(.*)Private$")
- set(pkg_names "${CMAKE_MATCH_1};${pkg}")
+ if (NOT ${__qt_pkg}_FOUND)
+ set(__qt_pkg_names ${__qt_pkg})
+ if(__qt_pkg MATCHES "(.*)Private$")
+ set(__qt_pkg_names "${CMAKE_MATCH_1};${__qt_pkg}")
endif()
- find_dependency(${pkg} ${version}
+ find_dependency(${__qt_pkg} ${__qt_version}
NAMES
- ${pkg_names}
+ ${__qt_pkg_names}
PATHS
${${find_dependency_path_list}}
${_qt_additional_packages_prefix_path}