Check if configure-time executable need to be recompiled

Respect source files that belong to configure-time executable when
reconfiguring Qt.

Amends: ac74b60c9c1101288eb2c558420ba69f675a2ee2

Task-number: QTBUG-87480
Change-Id: I7e42ffe8b1b79686c0cf93a02101f0b8e6be0bea
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Alexey Edelev 2022-09-27 19:14:14 +02:00
parent fdd1d54bc4
commit bcd08f86da

View File

@ -404,7 +404,23 @@ function(qt_internal_add_configure_time_executable target)
"${timestamp_file}"
)
if(NOT EXISTS "${target_binary_path}")
set(should_build_at_configure_time TRUE)
if(EXISTS "${target_binary_path}")
set(last_ts 0)
foreach(source IN LISTS sources)
file(TIMESTAMP "${source}" ts "%s")
if(${ts} GREATER ${last_ts})
set(last_ts ${ts})
endif()
endforeach()
file(TIMESTAMP "${target_binary_path}" ts "%s")
if(${ts} GREATER_EQUAL ${last_ts})
set(should_build_at_configure_time FALSE)
endif()
endif()
if(should_build_at_configure_time)
foreach(arg IN LISTS multi_value_args)
string(TOLOWER "${arg}" template_arg_name)
set(${template_arg_name} "")