This looks fine.
This is correct, but not a complete picture. tll
works by applying usage requirements of targets (the “right hand side”) to other targets (the “left hand side”). So target_link_libraries(tgt PRIVATE foo)
says “give tgt
the usage requirements of foo
, but not those using tgt
”. Usage requirements can be things like compile definitions, include directories, compile options, link options, libraries to link, and a few more.
Pretty much correct. Note that what it means to “find” a specific package can vary greatly.
If by “find” you mean “find where a library lives on the system”, yes. It has nothing to do with the linker finding said library though.
Here I see some confusion. target_include_directories(tgt)
does not “locate” anything. It just says “tell the compiler when to add these directories to the include search path when compiling tgt
”. This is basically a set of -I
flags pretty much everywhere.
There are two parts:
- finding where things are on the system
- using them for specific things
So the find_*
commands all handle the first part. But they do nothing about actually using this information. That belongs to the target_*
family of commands.
A package is a logical collection of artifacts (headers, libraries, resources, executables, whatever). find_library
is about finding a specific library.