...

/

Command Definitions: Macros

Command Definitions: Macros

Let's learn about command definition and macros in CMake.

We'll cover the following...

Command definitions

There are two ways to define our own command: we can use the macro() command or the function() command. The easiest way to explain the differences between these commands is by comparing them to C-style preprocessor macrosMacros are predefined code snippets in programming that can be invoked with a specific name and expanded inline, typically used for code generation or to simplify repetitive tasks. and actual C++ functions:

  • A macro() command works more like a find-and-replace instruction than an actual subroutine call such as function(). Contrary to ...