Consider changes of the CMake flags when re-building syncqt

Configure time executables don't adopt new cmake flags if they were
changed. Cache all flags that were used when building configure time
executables and consider changes when decide rebuilding them.

Pick-to: 6.6 6.5
Change-Id: Ifba77833f362c790120f0ab1f808a855327bc49f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: Amir Masoud Abdol <amir.abdol@qt.io>
This commit is contained in:
Alexey Edelev 2023-10-02 15:53:40 +02:00
parent cad7164ee2
commit 10e3075e6c

View File

@ -438,34 +438,10 @@ function(qt_internal_add_configure_time_executable target)
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} "")
if(DEFINED arg_${arg})
set(${template_arg_name} "${arg_${arg}}")
endif()
endforeach()
foreach(arg IN LISTS option_args)
string(TOLOWER "${arg}" template_arg_name)
set(${template_arg_name} "")
if(arg_${arg})
set(${template_arg_name} "${arg}")
endif()
endforeach()
file(MAKE_DIRECTORY "${target_binary_dir}")
set(template "${QT_CMAKE_DIR}/QtConfigureTimeExecutableCMakeLists.txt.in")
if(DEFINED arg_CMAKELISTS_TEMPLATE)
set(template "${arg_CMAKELISTS_TEMPLATE}")
endif()
set(cmake_flags_arg)
set(cmake_flags_arg "")
if(arg_CMAKE_FLAGS)
set(cmake_flags_arg CMAKE_FLAGS "${arg_CMAKE_FLAGS}")
endif()
configure_file("${template}" "${target_binary_dir}/CMakeLists.txt" @ONLY)
qt_internal_get_enabled_languages_for_flag_manipulation(enabled_languages)
foreach(lang IN LISTS enabled_languages)
@ -489,6 +465,35 @@ function(qt_internal_add_configure_time_executable target)
endif()
endforeach()
if(NOT "${QT_INTERNAL_CMAKE_FLAGS_CONFIGURE_TIME_TOOL_${target}}" STREQUAL "${cmake_flags_arg}")
set(should_build_at_configure_time TRUE)
endif()
if(should_build_at_configure_time)
foreach(arg IN LISTS multi_value_args)
string(TOLOWER "${arg}" template_arg_name)
set(${template_arg_name} "")
if(DEFINED arg_${arg})
set(${template_arg_name} "${arg_${arg}}")
endif()
endforeach()
foreach(arg IN LISTS option_args)
string(TOLOWER "${arg}" template_arg_name)
set(${template_arg_name} "")
if(arg_${arg})
set(${template_arg_name} "${arg}")
endif()
endforeach()
file(MAKE_DIRECTORY "${target_binary_dir}")
set(template "${QT_CMAKE_DIR}/QtConfigureTimeExecutableCMakeLists.txt.in")
if(DEFINED arg_CMAKELISTS_TEMPLATE)
set(template "${arg_CMAKELISTS_TEMPLATE}")
endif()
configure_file("${template}" "${target_binary_dir}/CMakeLists.txt" @ONLY)
if(EXISTS "${target_binary_dir}/CMakeCache.txt")
file(REMOVE "${target_binary_dir}/CMakeCache.txt")
endif()
@ -501,6 +506,9 @@ function(qt_internal_add_configure_time_executable target)
OUTPUT_VARIABLE try_compile_output
)
set(QT_INTERNAL_CMAKE_FLAGS_CONFIGURE_TIME_TOOL_${target}
"${cmake_flags_arg}" CACHE INTERNAL "")
file(WRITE "${timestamp_file}" "")
set(QT_INTERNAL_HAVE_CONFIGURE_TIME_${target} ${result} CACHE INTERNAL
"Indicates that the configure-time target ${target} was built")