Finding files, programs, and paths with CMake
Most projects quickly grow to a size and complexity where they depend on files, libraries, and perhaps even programs that are managed outside the project. CMake provides built-in commands to find these things. At first glance, the process of searching and finding things appears to be quite simple. However, on closer analysis, there are quite a few things to consider. First, we must handle the search order of where to find the files or programs we are looking for. Then, we might want to add more locations where the file might be, and finally, we must account for the differences between different operating systems.
On an abstraction level higher than the individual files, CMake can find whole packages that define targets, include paths, and package-specific variables. Refer to the Using third-party libraries in your CMake project section for more detail.
There are five find_...
commands that share very similar options and behaviors...