Command Definitions: Macros
Explore how to define macros in CMake and understand their unique behavior compared to functions. Learn about variable scope, argument access, and side effects to write clearer build scripts for your C++ projects.
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
A
macro()command works more like a find-and-replace instruction than an actual subroutine call such asfunction(). Contrary to ...