Documentation for add_compile_definitions() differs from actual behavior
The documentation for the new
add_compile_definitions() command states this:
Adds preprocessor definitions to the compiler command line for targets in the current directory and below that are added after this command is invoked.
This is not the case though, it affects all targets defined in the same directory scope whether those targets are added before or after the call to
add_compile_definitions(). The following minimal project demonstrates the behavior:
cmake_minimum_required(VERSION 3.11) project(CompDef) add_executable(main main.cpp) add_compile_definitions(FOO)
According to the docs, the compiler command line should not have any
-DFOO flag, but it does.