Structuring Projects

In this chapter, we will cover the following recipes:

  • Code reuse with functions and macros
  • Splitting CMake sources into modules
  • Writing a function to test and set compiler flags
  • Defining a function or macro with named arguments
  • Redefining functions and macros
  • Deprecating functions, macros, and variables
  • Limiting scope with add_subdirectory
  • Avoiding global variables using target_sources
  • Organizing Fortran projects

Get CMake Cookbook 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.