diff options
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/QtTargetHelpers.cmake | 45 |
1 files changed, 40 insertions, 5 deletions
diff --git a/cmake/QtTargetHelpers.cmake b/cmake/QtTargetHelpers.cmake index c9775ae384..98ac4cc29c 100644 --- a/cmake/QtTargetHelpers.cmake +++ b/cmake/QtTargetHelpers.cmake @@ -808,9 +808,8 @@ endif() endif() # INTERFACE libraries don't have IMPORTED_LOCATION-like properties. - # OBJECT libraries have properties like IMPORTED_OBJECTS instead. # Skip the rest of the processing for those. - if(target_type STREQUAL "INTERFACE_LIBRARY" OR target_type STREQUAL "OBJECT_LIBRARY") + if(target_type STREQUAL "INTERFACE_LIBRARY") continue() endif() @@ -868,6 +867,9 @@ endif()\n") set(write_implib FALSE) set(write_soname FALSE) + set(write_objects FALSE) + set(write_location TRUE) + if(target_type STREQUAL "SHARED_LIBRARY") if(WIN32) set(write_implib TRUE) @@ -876,24 +878,41 @@ endif()\n") else() set(write_soname TRUE) endif() + elseif(target_type STREQUAL "OBJECT_LIBRARY") + set(write_objects TRUE) + set(write_location FALSE) endif() if(NOT "${uc_release_cfg}" STREQUAL "") - string(APPEND content "get_target_property(_qt_imported_location ${full_target} IMPORTED_LOCATION_${uc_release_cfg})\n") + if(write_location) + string(APPEND content "get_target_property(_qt_imported_location ${full_target} IMPORTED_LOCATION_${uc_release_cfg})\n") + endif() if(write_implib) string(APPEND content "get_target_property(_qt_imported_implib ${full_target} IMPORTED_IMPLIB_${uc_release_cfg})\n") endif() if(write_soname) string(APPEND content "get_target_property(_qt_imported_soname ${full_target} IMPORTED_SONAME_${uc_release_cfg})\n") endif() + if(write_objects) + string(APPEND content "get_target_property(_qt_imported_objects ${full_target} IMPORTED_OBJECTS_${uc_release_cfg})\n") + # We generate CLR props as well, because that's what CMake generates for object + # libraries with CMake 3.27. They are usually empty strings though, aka "". + string(APPEND content "get_target_property(_qt_imported_clr ${full_target} IMPORTED_COMMON_LANGUAGE_RUNTIME_${uc_release_cfg})\n") + endif() + endif() + if(write_location) + string(APPEND content "get_target_property(_qt_imported_location_default ${full_target} IMPORTED_LOCATION_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n") endif() - string(APPEND content "get_target_property(_qt_imported_location_default ${full_target} IMPORTED_LOCATION_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n") if(write_implib) string(APPEND content "get_target_property(_qt_imported_implib_default ${full_target} IMPORTED_IMPLIB_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n") endif() if(write_soname) string(APPEND content "get_target_property(_qt_imported_soname_default ${full_target} IMPORTED_SONAME_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n") endif() + if(write_objects) + string(APPEND content "get_target_property(_qt_imported_objects_default ${full_target} IMPORTED_OBJECTS_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n") + string(APPEND content "get_target_property(_qt_imported_clr_default ${full_target} IMPORTED_COMMON_LANGUAGE_RUNTIME_$\{QT_DEFAULT_IMPORT_CONFIGURATION})\n") + endif() foreach(config ${configurations_to_export} "") string(TOUPPER "${config}" ucconfig) if("${config}" STREQUAL "") @@ -908,10 +927,12 @@ endif()\n") set_property(TARGET ${full_target} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${ucconfig}) ") endif() - string(APPEND content " + if(write_location) + string(APPEND content " if(_qt_imported_location${var_suffix}) set_property(TARGET ${full_target} PROPERTY IMPORTED_LOCATION${property_suffix} \"$\{_qt_imported_location${var_suffix}}\") endif()") + endif() if(write_implib) string(APPEND content " if(_qt_imported_implib${var_suffix}) @@ -924,6 +945,16 @@ if(_qt_imported_soname${var_suffix}) set_property(TARGET ${full_target} PROPERTY IMPORTED_SONAME${property_suffix} \"$\{_qt_imported_soname${var_suffix}}\") endif()") endif() + if(write_objects) + string(APPEND content " +if(_qt_imported_objects${var_suffix}) + set_property(TARGET ${full_target} PROPERTY IMPORTED_OBJECTS${property_suffix} \"$\{_qt_imported_objects${var_suffix}}\") +endif()") + string(APPEND content " +if(_qt_imported_clr${var_suffix}) + set_property(TARGET ${full_target} PROPERTY IMPORTED_COMMON_LANGUAGE_RUNTIME${property_suffix} \"$\{_qt_imported_clr${var_suffix}}\") +endif()") + endif() string(APPEND content "\n") endforeach() endforeach() @@ -934,6 +965,10 @@ unset(_qt_imported_location) unset(_qt_imported_location_default) unset(_qt_imported_soname) unset(_qt_imported_soname_default) +unset(_qt_imported_objects) +unset(_qt_imported_objects_default) +unset(_qt_imported_clr) +unset(_qt_imported_clr_default) unset(_qt_imported_configs)") endif() |