I am reviewing at my work some code that a developer submitted and a big red flag went up for me. I wanted to make sure I’m not the one misunderstanding find_package before I really dig in with my objections to some changes. I want to be sure our project uses CMake in an idiomatic way as much as possible.
In essence this person is using CMake and find_package in the following way. Executable target A has in its CMakeLists.txt a call to find_package(B). Dependency B has a B.cmake file located in some folder that was added to the project via CMAKE_MODULE_PATH. B.cmake internally does an add_subdirectory(B). In B’s subdirectory it has a regular CMakeLists.txt which builds itself.
My understanding of idiomatic usage of find_package is stuff like this:
find_package(Qt5 COMPONENTS Core QuickCompiler REQUIRED)
or
find_package(Boost)
neither of the above two lines would attempt to build Qt or Boost. Maybe this whole question is stupid, but my understanding of find_package is that it tries to find, not build.
Am I right to object to the proposed usage?