Add support for _qt_internal_configure_file(GENERATE ... INPUT

Allow generating files from template file. The signature first
expands the '@' wrapped variables in template file and then generates
the resulting file using file(GENERATE command.

Pick-to: 6.8
Change-Id: I0b4cf557da1d5161ffcde1c44aea98c440427980
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 5c30ae2c9f57d58b52effa1460c4bc38da29952a)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexey Edelev 2025-04-22 10:57:33 +02:00 committed by Qt Cherry-pick Bot
parent 1dc962cbe0
commit 662670febd

View File

@ -831,12 +831,12 @@ function(_qt_internal_configure_file mode)
# the generator expressions evaluation inside the resulting CONTENT.
if(mode STREQUAL "GENERATE")
if(arg_INPUT)
# This is not a limitation of any kind, simply is not required at
# implementation time. Feel free to extend.
message(FATAL_ERROR "GENERATE mode doesn't support INPUT argument.")
endif()
configure_file("${arg_INPUT}" "${arg_OUTPUT}.tmp" @ONLY)
file(GENERATE OUTPUT "${arg_OUTPUT}" INPUT "${arg_OUTPUT}.tmp")
else()
string(CONFIGURE "${arg_CONTENT}" arg_CONTENT @ONLY)
file(GENERATE OUTPUT "${arg_OUTPUT}" CONTENT "${arg_CONTENT}")
endif()
return()
endif()