Chapter 13: Reusing CMake Code

Writing build system code for a project is no easy task. Project maintainers and developers are spending a lot of effort on writing CMake code for configuring compiler flags, project build variants, third-party libraries, and tool integrations. Writing CMake code for project-agnostic details from scratch may start to incur a significant burden when dealing with multiple CMake projects. Most of the CMake code written for a project to configure the aforementioned details could be reused between the projects. With that in mind, it is for our benefit to develop a strategy to make our CMake code reuse-friendly. The straightforward way to approach this problem is to treat CMake code as regular code and apply some of ...

Get CMake Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.