Greetings,
I have an issue with pkg_check_modules()
(cmake version 3.22.3) and I seem not to be able to solve it (been trying for more than a week).
I have two CMake projects, lets call them A and B.
Project A
add_library(targetA SHARED ...)
pkg_check_modules(GST REQUIRED IMPORTED_TARGET GLOBAL gstreamer-1.0)
target_link_libraries(targetA PUBLIC PkgConfig::GST)
# here comes installing the ATargets.cmake and AConfig.cmake
Project B
Project B depends on Project A by using the targetA. Basically, it does the following:
find_package(A)
Issue
The issue I am having is that the generated ATargets.cmake
file contains the following line:
set_target_properties(A::targetA PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
INTERFACE_LINK_LIBRARIES "PkgConfig::GST"
)
…so when building project B, the find_package(A)
call fails with the error message:
The link interface of target "A::targetA" contains:
|
| PkgConfig::GST
|
| but the target was not found. Possible reasons include:
|
| * There is a typo in the target name.
| * A find_package call is missing for an IMPORTED target.
| * An ALIAS target is missing.
According to the pkg_check_modules documentation, the call creates the PkgConfig::GST
imported target, but I don’t quite understand what this means. Where is the target, I can’t seem to find any files being generated. I was trying to install this created PkgConfig::GST
target, but with no luck.
Thanks for any support on this.