Improve pkg-config file generation
* Don't refer to bundles libraries via its imported location * Add dependencies of imported targets
This commit is contained in:
parent
389a0ef4da
commit
79855f285d
|
@ -294,24 +294,39 @@ macro (compute_dependencies_for_package_config
|
|||
continue()
|
||||
endif ()
|
||||
# add library location of the target
|
||||
if (META_CURRENT_CONFIGURATION)
|
||||
set(HAS_LIBRARY_LOCATION NO)
|
||||
if (DEPENDENCY IN_LIST BUNDLED_TARGET)
|
||||
set(${OUTPUT_VAR_LIBS} "${${OUTPUT_VAR_LIBS}} -l${DEPENDENCY}")
|
||||
set(HAS_LIBRARY_LOCATION YES)
|
||||
endif ()
|
||||
if (NOT HAS_LIBRARY_LOCATION AND META_CURRENT_CONFIGURATION)
|
||||
get_target_property("${DEPENDENCY_VARNAME}_IMPORTED_LOCATION_${META_CURRENT_CONFIGURATION}" "${DEPENDENCY}"
|
||||
"IMPORTED_LOCATION_${META_CURRENT_CONFIGURATION}")
|
||||
if (EXISTS "${${DEPENDENCY_VARNAME}_IMPORTED_LOCATION_${META_CURRENT_CONFIGURATION}}")
|
||||
set(${OUTPUT_VAR_LIBS}
|
||||
"${${OUTPUT_VAR_LIBS}} ${${DEPENDENCY_VARNAME}_IMPORTED_LOCATION_${META_CURRENT_CONFIGURATION}}")
|
||||
continue()
|
||||
set(HAS_LIBRARY_LOCATION YES)
|
||||
endif ()
|
||||
endif ()
|
||||
if (NOT HAS_LIBRARY_LOCATION)
|
||||
get_target_property("${DEPENDENCY_VARNAME}_IMPORTED_LOCATION" "${DEPENDENCY}" IMPORTED_LOCATION)
|
||||
if (EXISTS "${${DEPENDENCY_VARNAME}_IMPORTED_LOCATION}")
|
||||
set(${OUTPUT_VAR_LIBS} "${${OUTPUT_VAR_LIBS}} ${${DEPENDENCY_VARNAME}_IMPORTED_LOCATION}")
|
||||
continue()
|
||||
set(HAS_LIBRARY_LOCATION YES)
|
||||
endif ()
|
||||
endif ()
|
||||
# assume the target is a 3rd party library built within the current project as a bundled dependency -> the target
|
||||
# is supposed to be installed in either a standard search directory or the same directory as this library so a
|
||||
# simple -l flag should be sufficient
|
||||
if (NOT HAS_LIBRARY_LOCATION)
|
||||
set(${OUTPUT_VAR_LIBS} "${${OUTPUT_VAR_LIBS}} -l${DEPENDENCY}")
|
||||
endif ()
|
||||
get_target_property("${DEPENDENCY_VARNAME}_IMPORTED_LINK_INTERFACE_LIBRARIES" "${DEPENDENCY}" "IMPORTED_LINK_INTERFACE_LIBRARIES")
|
||||
foreach (LIBRARY ${${DEPENDENCY_VARNAME}_IMPORTED_LINK_INTERFACE_LIBRARIES})
|
||||
if (NOT TARGET ${LIBRARY} AND EXISTS ${LIBRARY})
|
||||
set(${OUTPUT_VAR_LIBS} "${${OUTPUT_VAR_LIBS}} ${LIBRARY}")
|
||||
endif ()
|
||||
endforeach ()
|
||||
else ()
|
||||
# add raw dependency
|
||||
set(${OUTPUT_VAR_LIBS} "${${OUTPUT_VAR_LIBS}} ${DEPENDENCY}")
|
||||
|
|
Loading…
Reference in New Issue