summaryrefslogtreecommitdiffstats
path: root/cmake/QtBaseGlobalTargets.cmake
diff options
context:
space:
mode:
authorLeander Beernaert <leander.beernaert@qt.io>2019-08-19 16:19:08 +0200
committerLeander Beernaert <leander.beernaert@qt.io>2019-08-22 09:47:01 +0000
commit7a1853dbe2a3e316900ed1daf9f05deb37413d72 (patch)
tree882208a1912a5ab80c4c25ec7265fb8502d4305d /cmake/QtBaseGlobalTargets.cmake
parent3cb9ee3a5b36e2c10dbaf1564852472e7e02a1ae (diff)
Extract add_qt_resource into reusable components
This patch moves all of the underlying code for add_qt_resource into a common reusable snippet for both the Qt build and user projects. For users, the new API is available under QT5_ADD_RESOURCES. If outfiles is a CMAKE target we will use the new API, otherwise we will fall back to the old behavior. This patch also adds EXTRA_CMAKE_FILES and EXTRA_CMAKE_INCLUDES to add_qt_module so that module specific cmake files can be installed and loaded by the module's config.cmake. The code will be installed under CMAKE_BINARY_DIR/Qt{}CoreResource.cmake and is injected into Qt{}Core_Config.cmake via the extra cmake includes passed into add_qt_module. To make sure it still works with QtBuild, we do the actual generation of the file from QtBaseGlobalTargets and include the generated file there as well. Change-Id: I85fefaa11dde01a6790d23c62d6a64cd157e2617 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'cmake/QtBaseGlobalTargets.cmake')
-rw-r--r--cmake/QtBaseGlobalTargets.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake
index f17b47f675..ecfb4429d2 100644
--- a/cmake/QtBaseGlobalTargets.cmake
+++ b/cmake/QtBaseGlobalTargets.cmake
@@ -229,3 +229,13 @@ qt_install(FILES
DESTINATION "${__build_internals_install_dir}"
COMPONENT Devel
)
+
+# Generate the new resource API
+set(QT_CORE_RESOURCE_GENERATED_FILE_NAME "${INSTALL_CMAKE_NAMESPACE}CoreResource.cmake" CACHE INTERNAL "")
+set(QT_CORE_RESOURCE_GENERATED_FILE_PATH "${CMAKE_CURRENT_BINARY_DIR}/${QT_CORE_RESOURCE_GENERATED_FILE_NAME}" CACHE INTERNAL "")
+configure_file(
+ "${CMAKE_CURRENT_SOURCE_DIR}/cmake/QtResource.cmake.in"
+ "${QT_CORE_RESOURCE_GENERATED_FILE_PATH}"
+ @ONLY
+)
+include(${QT_CORE_RESOURCE_GENERATED_FILE_PATH})