Summary
Understanding targets is critical to writing clean, modern CMake projects. In this chapter, we have not only discussed what constitutes a target and how to define three different types of targets: executables, libraries and custom targets. We have also explained how targets depend on each other through dependency graph and we learned how to visualize it using the Graphviz module. With this general understanding, we were able to learn about the key feature of targets – properties. We not only went through a few commands to set regular properties on targets but we also solved the mystery of transitive usage requirements also known as propagated properties. This was a hard one to crack, as we had to not only understand how to control which properties are propagated but also how that propagation is affecting subsequent targets. Furthermore, we discovered how to guarantee the compatibility of properties consumed from multiple sources.
We then briefly discussed pseudo targets...