In CMake documentation, we can read:

add_definitions

Adds flags to the compiler command line for sources in the current directory and below.

COMPILE_DEFINITIONS property on directories

COMPILE_DEFINITIONS: Preprocessor definitions for compiling a directory's sources.

COMPILE_DEFINITIONS property on targets

COMPILE_DEFINITIONS: Preprocessor definitions for compiling a target's sources.

COMPILE_DEFINITIONS property on source files

COMPILE_DEFINITIONS: Preprocessor definitions for compiling a source file.

COMPILE_DEFINITIONS and add_definitions functionality seems to overlap. COMPILE_DEFINITIONS property seems more flexible.

So it seems that COMPILE_DEFINITIONS property does everything add_definitions does, and even more.

So, in which cases must we call add_definitions because COMPILE_DEFINITIONS property cannot be used?

Edit
Report