It’s not immediately obvious which functions run at which time. For example file(WRITE | APPEND)
runs at configure time, file(CONFIGURE)
at generate time.
This code runs at configure time:
file(WRITE eval.cmake ...)
include(eval.cmake)
This code runs at generate time:
file(CONFIGURE OUTPUT eval.cmake CONTENT ...)
# error: include could not find requested file
# include(eval.cmake)
file(WRITE) creates the file in the source directory and file(CONFIGURE) in the binary directory. This is hard to remember. Shouldn’t the creation of any file default to the binary directory? I know it makes sense the way it is but it makes it much harder to write CMake code.
Is there any resource get an overview, or a way to make it easier to memorize which functions are used at which time?