Fix build of Debug projects against debug-and-release non-prefix Qt
Building a CMake project with CMAKE_BUILD_CONFIG=Debug was broken for non-prefix debug-and-release builds of Qt. In debug-and-release builds we set EXCLUDE_FROM_ALL on tools in the Debug configuration. In non-prefix builds we export(EXPORT) targets, and that also contains the non-existent Debug variants of the tools. In prefix builds, we install(EXPORT) instead, which only exports what is built and installed. Consequently, we now remove the DEBUG-related import information if the debug variant if the target binary does not exist. Pick-to: 6.2 Fixes: QTBUG-95027 Change-Id: I37766d5ab1e2795bcb91a348e7e72150e8a00f82 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
parent
1a57a4974b
commit
7540b4bd56
@ -469,8 +469,26 @@ endif()
|
||||
continue()
|
||||
endif()
|
||||
|
||||
# FIXME: Don't add IMPORTED_SOLIB and IMPORTED_SONAME properties for executables.
|
||||
set(properties_retrieved TRUE)
|
||||
|
||||
# Non-prefix debug-and-release builds: add check for the existence of the debug binary of
|
||||
# the target. It is not built by default.
|
||||
if(NOT QT_WILL_INSTALL AND QT_FEATURE_debug_and_release)
|
||||
get_target_property(excluded_genex ${target} EXCLUDE_FROM_ALL)
|
||||
if(NOT excluded_genex STREQUAL "")
|
||||
string(APPEND content "
|
||||
# ${full_target} is not built by default in the Debug configuration. Check existence.
|
||||
get_target_property(_qt_imported_location ${full_target} IMPORTED_LOCATION_DEBUG)
|
||||
if(NOT EXISTS \"$\\{_qt_imported_location}\")
|
||||
get_target_property(_qt_imported_configs ${full_target} IMPORTED_CONFIGURATIONS)
|
||||
list(REMOVE_ITEM _qt_imported_configs DEBUG)
|
||||
set_property(TARGET ${full_target} PROPERTY IMPORTED_CONFIGURATIONS $\\{_qt_imported_configs})
|
||||
set_property(TARGET ${full_target} PROPERTY IMPORTED_LOCATION_DEBUG)
|
||||
endif()\n\n")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# FIXME: Don't add IMPORTED_SOLIB and IMPORTED_SONAME properties for executables.
|
||||
if(NOT "${uc_release_cfg}" STREQUAL "")
|
||||
string(APPEND content "get_target_property(_qt_imported_location ${full_target} IMPORTED_LOCATION_${uc_release_cfg})\n")
|
||||
string(APPEND content "get_target_property(_qt_imported_implib ${full_target} IMPORTED_IMPLIB_${uc_release_cfg})\n")
|
||||
@ -512,7 +530,8 @@ endif()
|
||||
unset(_qt_imported_location)
|
||||
unset(_qt_imported_location_default)
|
||||
unset(_qt_imported_soname)
|
||||
unset(_qt_imported_soname_default)")
|
||||
unset(_qt_imported_soname_default)
|
||||
unset(_qt_imported_configs)")
|
||||
endif()
|
||||
|
||||
qt_path_join(output_file "${arg_CONFIG_INSTALL_DIR}"
|
||||
|
Loading…
Reference in New Issue
Block a user