How do I introduce find_dependency calls into my generated foo-config.cmake file?
问题 I have a CMake project named foo . In its CMakeLists.txt , and among other commands, I have: install( EXPORT foo_export DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/foo" NAMESPACE "foo::" FILE foo-config.cmake ) (and also a write_basic_package_version_file() call later on.) Now, I want foo-config.cmake to also check for a dependency bar of foo , with find_dependency() . How do I do that, other than by replacing the .cmake file generation with something manual? Notes: I'm interested both in the