Defining components
We’ll begin by addressing potential confusion surrounding the term component. Consider the full signature for find_package()
:
find_package(<PackageName>
[version] [EXACT] [QUIET] [MODULE] [REQUIRED]
[[COMPONENTS] [components...]]
[OPTIONAL_COMPONENTS components...]
[NO_POLICY_SCOPE]
)
It’s important not to confuse the components mentioned here with the COMPONENT
keyword that’s used in the install()
command. Despite sharing the same name, they are distinct concepts and must be understood separately. We’ll explore this further in the following subsections.
How to use components in find_package()
When calling find_package()
with a list of COMPONENTS
or OPTIONAL_COMPONENTS
, we indicate to CMake that we are only interested in packages that provide these components. However, it’s crucial to understand that verifying this requirement is the responsibility of...