CMake: Fully rebuild dirty configure-time executables
Problem: "ninja clean" does not fully clean the build directories of configure-time executables (e.g. syncqt). This can lead to problems when building with compiler and linker launchers: on configure time, the launchers are not used (compare CMake issue #20762). After a "ninja clean", the executable might be removed but the object files are still there. This leads to a situation where the object files have been created without the compiler launcher but are linked with the linker launcher. We encountered a situation however, where the linker launcher requires the usage of the compiler launcher. The configure-time executable has a ${target}_build custom command that runs "cmake --build" and creates a timestamp file to track when to build the target. To circumvent the problem of stale object files we add the "--clean-first" argument to that target to fully rebuild configure-time executables if the timestamp file is out of date. The performance this imposes is negligible, because 1. Those configure-time executables are seldom out of date. 2. They are supposed to be "tiny executables with system dependencies only" anyway. Pick-to: 6.5 Change-Id: I701f9089f5ad941ffdf235aeccc3119b68c4e3e3 Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
This commit is contained in:
parent
be4de03b37
commit
aad3b1f063
@ -402,7 +402,7 @@ function(qt_internal_add_configure_time_executable target)
|
||||
set(timestamp_file "${target_binary_dir}/${target_binary}_timestamp")
|
||||
add_custom_command(OUTPUT "${target_binary_path}" "${timestamp_file}"
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} --build "${target_binary_dir}" ${config_build_arg}
|
||||
${CMAKE_COMMAND} --build "${target_binary_dir}" --clean-first ${config_build_arg}
|
||||
COMMAND
|
||||
${CMAKE_COMMAND} -E touch "${timestamp_file}"
|
||||
DEPENDS
|
||||
|
Loading…
Reference in New Issue
Block a user