Note that the substitution of placeholders with values expects the variable names in CMake to be exactly the same as those used in the to-be configured file, and placed in between @-markers. Any CMake variable defined at the point where configure_file is invoked can be used. This includes all built-in CMake variables, such as CMAKE_VERSION or CMAKE_GENERATOR, in our example. Moreover, whenever the template file is modified, rebuilding the code will trigger a regeneration of the build system. In this way, the configured file will always be up to date.
A complete list of internal CMake variables can be obtained from the CMake manual by using cmake --help-variable-list.
The command file(GENERATE ...) provides an interesting alternative to configure_file as it allows generator expressions to be evaluated as part of the configured file. However, file(GENERATE ...) updates the output file every time CMake is run which forces a rebuild of all targets which depend on that output. See also https://crascit.com/2017/04/18/generated-sources-in-cmake-builds/.