diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index c4e424a9df4..c5ced2738c2 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -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()