From 5c30ae2c9f57d58b52effa1460c4bc38da29952a Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Tue, 22 Apr 2025 10:57:33 +0200 Subject: [PATCH] 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 6.9 Change-Id: I0b4cf557da1d5161ffcde1c44aea98c440427980 Reviewed-by: Alexandru Croitor --- cmake/QtPublicCMakeHelpers.cmake | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cmake/QtPublicCMakeHelpers.cmake b/cmake/QtPublicCMakeHelpers.cmake index 0888b2a8d49..ac669bfa6c6 100644 --- a/cmake/QtPublicCMakeHelpers.cmake +++ b/cmake/QtPublicCMakeHelpers.cmake @@ -880,12 +880,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.") + 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() - string(CONFIGURE "${arg_CONTENT}" arg_CONTENT @ONLY) - file(GENERATE OUTPUT "${arg_OUTPUT}" CONTENT "${arg_CONTENT}") return() endif()