diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2020-02-24 15:56:12 +0100 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2020-02-24 16:37:27 +0000 |
commit | 3a29497717bc56ae7bca4b520aa9995d88b73cc8 (patch) | |
tree | 0ad31ad685397d9c90fea71f211b9c1fce85d32e /cmake | |
parent | ca2dd71d77b203f6854ec692cacc28fda767c877 (diff) |
CMake build: Add a qtc_glob_resources function
This is the CMake equivalent of "RESOURCES = $$files()" from qmake.
Use it in StudioWelcome for the Qml resources.
Change-Id: I2f495e2c4bad9f0bb488dee7e8966e31acb51b5a
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtCreatorAPI.cmake | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cmake/QtCreatorAPI.cmake b/cmake/QtCreatorAPI.cmake index c2bd8604308..bbfb0a214be 100644 --- a/cmake/QtCreatorAPI.cmake +++ b/cmake/QtCreatorAPI.cmake @@ -1124,3 +1124,16 @@ function(finalize_qtc_gtest test_name) finalize_test_setup(${test}) endforeach() endfunction() + +# This is the CMake equivalent of "RESOURCES = $$files()" from qmake +function(qtc_glob_resources) + cmake_parse_arguments(_arg "" "QRC_FILE;ROOT;GLOB" "" ${ARGN}) + + file(GLOB_RECURSE fileList RELATIVE "${_arg_ROOT}" "${_arg_ROOT}/${_arg_GLOB}") + set(qrcData "<RCC><qresource>\n") + foreach(file IN LISTS fileList) + string(APPEND qrcData " <file alias=\"${file}\">${_arg_ROOT}/${file}</file>\n") + endforeach() + string(APPEND qrcData "</qresource></RCC>") + file(WRITE "${_arg_QRC_FILE}" "${qrcData}") +endfunction() |