diff options
author | Alexey Edelev <alexey.edelev@qt.io> | 2023-01-03 17:54:18 +0100 |
---|---|---|
committer | Alexey Edelev <alexey.edelev@qt.io> | 2023-01-05 20:01:21 +0100 |
commit | 6f7d09677a0759328bd27388c320ff60b45c6aff (patch) | |
tree | 3a40e9982a40ad798ec239a3322ee2019a4cd76a | |
parent | 91f18c92d75be6f1fda40778d85f60748eb0c5ca (diff) |
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>
-rw-r--r-- | cmake/QtConfigureTimeExecutableCMakeLists.txt.in | 2 | ||||
-rw-r--r-- | cmake/QtExecutableHelpers.cmake | 16 | ||||
-rw-r--r-- | src/tools/syncqt/CMakeLists.txt | 2 |
3 files changed, 13 insertions, 7 deletions
diff --git a/cmake/QtConfigureTimeExecutableCMakeLists.txt.in b/cmake/QtConfigureTimeExecutableCMakeLists.txt.in index fcf30d6d38..a36299706c 100644 --- a/cmake/QtConfigureTimeExecutableCMakeLists.txt.in +++ b/cmake/QtConfigureTimeExecutableCMakeLists.txt.in @@ -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}) diff --git a/cmake/QtExecutableHelpers.cmake b/cmake/QtExecutableHelpers.cmake index 9633cc00a9..d87b60c250 100644 --- a/cmake/QtExecutableHelpers.cmake +++ b/cmake/QtExecutableHelpers.cmake @@ -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() diff --git a/src/tools/syncqt/CMakeLists.txt b/src/tools/syncqt/CMakeLists.txt index 0152c53450..bcd39bfa8b 100644 --- a/src/tools/syncqt/CMakeLists.txt +++ b/src/tools/syncqt/CMakeLists.txt @@ -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} |