Can't export top level lib with dependency on subdir lib

They should just need to do find_package(yourprogram). yourprogram-config.cmake does find_package() for your dependencies to bring in their imported targets. I usually add them to cmake in the source tree and beside yourpackage-config.cmake in the build/install tree. Just scope it so your Find modules don’t interfere with the caller’s.

set(CMAKE_MODULE_PATH_save "${CMAKE_MODULE_PATH}")
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_LIST_DIR}")

# Any find_packages you need.

set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH_save}")
unset(CMAKE_MODULE_PATH_save)

I’d write a FindFoo.cmake that does the pkg_search_module inside of it.

The case for my own library was clear( generated yourprogram-config.cmake) , but I was questioning case when why library depends on external target for which I had to create either a) FindSublib.cmake or b) process Sublib-supplied pkg config.pc file. So as you suggested b) should used inside a).

With this I observed for a 3rd party sublib, .pc file contains lib and include paths that different ( match path the build was done) than the actual path on my system and when I modified path inside .pc file , pkg_search_module still sets pkg_LIBRARY_DIR and _INCLUDE to wrong path value. I see some Makefile in the siblib tree has this path , but is not pkg_search_module supposed to take it only from .pc file?

Do you have actual changes to show as an example? I’m not getting a clear picture of what you’re encountering from your description.