summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBuild.cmake10
-rw-r--r--cmake/QtModuleConfig.cmake.in4
2 files changed, 14 insertions, 0 deletions
diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index cc5b9e63e1..50722a5475 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -930,6 +930,16 @@ function(add_qt_module target)
list(APPEND extra_cmake_includes "${INSTALL_CMAKE_NAMESPACE}${target}ConfigExtras.cmake")
endif()
+ set(extra_cmake_code "")
+
+ if(target STREQUAL Core)
+ # Propagate non-build related variables that are needed for consuming Qt packages.
+ # Do this in CoreConfig instead of Qt5Config, so that consumers can also use
+ # find_package(Qt5Core) instead of find_package(Qt5 COMPONENTS Core)
+ string(APPEND extra_cmake_code "
+set(QT_CMAKE_EXPORT_NAMESPACE ${QT_CMAKE_EXPORT_NAMESPACE})")
+ endif()
+
configure_package_config_file(
"${QT_CMAKE_DIR}/QtModuleConfig.cmake.in"
"${config_build_dir}/${INSTALL_CMAKE_NAMESPACE}${target}Config.cmake"
diff --git a/cmake/QtModuleConfig.cmake.in b/cmake/QtModuleConfig.cmake.in
index 7baea8cf9c..6a68fdf3b0 100644
--- a/cmake/QtModuleConfig.cmake.in
+++ b/cmake/QtModuleConfig.cmake.in
@@ -5,6 +5,10 @@ include(CMakeFindDependencyMacro)
get_filename_component(_import_prefix "${CMAKE_CURRENT_LIST_FILE}" PATH)
get_filename_component(_import_prefix "${_import_prefix}" REALPATH)
+# Extra cmake code begin
+@extra_cmake_code@
+# Extra cmake code end
+
# Find required dependencies, if any.
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/@INSTALL_CMAKE_NAMESPACE@@target@Dependencies.cmake")