From a Simple Executable to Libraries

In this chapter, we will cover the following recipes:

  • Compiling a single source file into an executable
  • Switching generators
  • Building and linking static and shared libraries
  • Controlling compilation with conditionals
  • Presenting options to the user
  • Specifying the compiler
  • Switching the build type
  • Controlling compiler flags
  • Setting the standard for the language
  • Using control flow constructs

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.