Change the RUNTIME_OUTPUT_DIRECTORY for configure-time executables

Set the RUNTIME_OUTPUT_DIRECTORY for configure-time executables so
executable will be located inside the QT_BUILD_DIR. This allows to
re-build syncqt and make sure ithat ts binary is replaced and located
in the libexec directory.

Comment on how to rebuild syncqt. Configure-time tools reserve the
original tool name for the imported executable. To re-build syncqt use
'syncqt_build' target.

Task-number: QTBUG-109792
Change-Id: Id7d912b1d75d18d82cb2a69fbd62b89440120d78
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexey Edelev 2023-01-03 17:54:18 +01:00
parent 91f18c92d7
commit 6f7d09677a
3 changed files with 13 additions and 7 deletions

View File

@ -6,6 +6,7 @@ set(packages "@packages@")
set(defines @defines@)
set(compile_options @compile_options@)
set(link_options @link_options@)
set(output_directory @output_directory@)
foreach(package IN LISTS packages)
find_package(${package} REQUIRED)
@ -14,6 +15,7 @@ endforeach()
add_executable(@configure_time_target@ @win32@ @macosx_bundle@ @sources@)
set_target_properties(@configure_time_target@ PROPERTIES
INCLUDE_DIRECTORIES "@include_directories@"
RUNTIME_OUTPUT_DIRECTORY "${output_directory}"
)
target_compile_options(@configure_time_target@ PRIVATE ${compile_options})

View File

@ -374,8 +374,14 @@ function(qt_internal_add_configure_time_executable target)
set(configure_time_target "${arg_OUTPUT_NAME}")
endif()
set(target_binary "${configure_time_target}${CMAKE_EXECUTABLE_SUFFIX}")
set(install_dir "${INSTALL_BINDIR}")
if(arg_INSTALL_DIRECTORY)
set(install_dir "${arg_INSTALL_DIRECTORY}")
endif()
set(output_directory "${QT_BUILD_DIR}/${install_dir}")
set(target_binary_path
"${target_binary_dir}/${configuration_path}${target_binary}")
"${output_directory}/${configuration_path}${target_binary}")
get_filename_component(target_binary_path "${target_binary_path}" ABSOLUTE)
if(NOT DEFINED arg_SOURCES)
@ -385,7 +391,7 @@ function(qt_internal_add_configure_time_executable target)
# Timestamp file is required because CMake ignores 'add_custom_command' if we use only the
# binary file as the OUTPUT.
set(timestamp_file "${target_binary_path}_timestamp")
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}
@ -468,15 +474,11 @@ function(qt_internal_add_configure_time_executable target)
IMPORTED_LOCATION "${target_binary_path}")
if(NOT arg_NO_INSTALL)
set(install_dir "${INSTALL_BINDIR}")
if(arg_INSTALL_DIRECTORY)
set(install_dir "${arg_INSTALL_DIRECTORY}")
endif()
set_target_properties(${target} PROPERTIES
_qt_internal_configure_time_target_install_location
"${install_dir}/${target_binary}"
)
qt_path_join(target_install_dir ${QT_INSTALL_DIR} ${install_dir})
qt_copy_or_install(PROGRAMS "${target_binary_path}" DESTINATION "${target_install_dir}")
qt_install(PROGRAMS "${target_binary_path}" DESTINATION "${target_install_dir}")
endif()
endfunction()

View File

@ -13,6 +13,8 @@ if(CMAKE_OSX_ARCHITECTURES)
set(osx_architectures "-DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHITECTURES}")
endif()
qt_get_tool_target_name(target_name syncqt)
# Note: configure-time tools reserve the original tool name for the imported executable.
# To re-build syncqt use 'syncqt_build' target.
qt_internal_add_configure_time_tool(${target_name}
DEFINES ${compile_definitions}
COMPILE_OPTIONS ${optimize_full_flags}