Defining components
We'll start talking about package components by clearing up some possible confusion around the term component. Look at the full signature for find_package()
:
find_package(<PackageName> [version] [EXACT] [QUIET] [MODULE] [REQUIRED] [[COMPONENTS] [components...]] [OPTIONAL_COMPONENTS components...] [NO_POLICY_SCOPE])
The components that are mentioned here shouldn't be conflated with the COMPONENT
keyword that's used in the install()
command. They are different concepts that must be understood separately, despite sharing the same name. We'll look at this in more detail in the following subsections.
How to use components in find_package()
When we call find_package()
with a list of COMPONENTS
or OPTIONAL_COMPONENTS
, we tell CMake that we're only interested in packages that...