When a library defines a build with CMake and goes through the trouble of building an install package for itself, there will be a XXXConfig.cmake
.
If a library doesn't have a way to export it's targets to CMake, CMake tries to bridge the gap by providing FindXXX.cmake
scripts that attempt to locate such libraries.
In the docs, FindXXX.cmake
(module mode), is attempted first, and only if that fails does it attempt to use XXXConfig.cmake
(config mode). But this seems like a really backwards to me.
The problem is, for example, I have built CURL from source, and the ConfigXXX produces a different target name than FindXXX, so, when trying to use it, it fails because FindXXX took responsibility for the find_package request and loaded a different target name than what I was expecting.
Can I at least tell CMake somehow to do things the other way around? Config mode first.
I know I can disable module mode entirely, but I'd rather have it as a fallback option.