Answers
The following are the answers to this chapter’s questions:
- Commands that are added with
add_custom_command
are executed at build time, while commands that are added withexecute_process
are executed at configuration time. - One signature is used to create custom build steps, while the other is used to generate files.
- Only
POST_BUILD
is reliably supported across all generators. - Variables can be defined either as
${VAR}
or@VAR@
. - Variable substitution can be controlled by either passing
@ONLY
, which only replaces variables defined as@VAR@
, or by specifying theCOPYONLY
option, which does not perform any substitution at all. - With
cmake -E
, common tasks can be executed directly. Withcmake -P
,.cmake
files can be executed as scripts.