Use the existing imported location for syncqt in developer builds

In developer builds we don't install tools, so syncqt executable is
located in its RUNTIME_OUTPUT_DIRECTORY but not by install path. This
works fine in general case, but in multi-config builds the
RUNTIME_OUTPUT_DIRECTORY path doesn't match the install path. So syncqt
target points to wrong location in this case. It makes sense to use the
existing IMPORTED_LOCATION of syncqt executable directly if Qt is not
supposed to be installed. Also check if the syncqt executable exists at
the expected location before creating the imported target.

Pick-to: 6.5
Fixes: QTBUG-109864
Change-Id: I0de647b2a73169a0d48bd88edeb7ff00975fa774
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Alexey Edelev 2023-01-06 10:23:51 +01:00
parent 5e295382d7
commit 2bf54da75a

View File

@ -568,17 +568,32 @@ endif()
get_target_property(is_configure_time_target ${target} _qt_internal_configure_time_target)
if(is_configure_time_target)
get_target_property(configure_time_target_install_location ${target}
_qt_internal_configure_time_target_install_location)
# For Multi-config developer builds we should simply reuse IMPORTED_LOCATION of the
# target.
if(NOT QT_WILL_INSTALL AND QT_FEATURE_debug_and_release)
get_target_property(configure_time_target_install_location ${target}
IMPORTED_LOCATION)
else()
get_target_property(configure_time_target_install_location ${target}
_qt_internal_configure_time_target_install_location)
set(configure_time_target_install_location
"$\{PACKAGE_PREFIX_DIR}/${configure_time_target_install_location}")
endif()
if(configure_time_target_install_location)
string(APPEND content "
# Import configure-time executable ${full_target}
if(NOT TARGET ${full_target})
set(_qt_imported_location \"${configure_time_target_install_location}\")
if(NOT EXISTS \"$\{_qt_imported_location}\")
message(FATAL_ERROR \"Unable to add configure time executable ${full_target}\"
\" $\{_qt_imported_location} doesn't exists\")
endif()
add_executable(${full_target} IMPORTED)
set_property(TARGET ${full_target} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${default_cfg})
set_target_properties(${full_target} PROPERTIES IMPORTED_LOCATION_${uc_default_cfg}
\"$\{PACKAGE_PREFIX_DIR}/${configure_time_target_install_location}\")
\"$\{_qt_imported_location}\")
set_property(TARGET ${full_target} PROPERTY IMPORTED_GLOBAL TRUE)
unset(_qt_imported_location)
endif()
\n")
endif()