There is pretty new but cool feature in CMake: presets
I am confused with some of the possible values of preset: toolchainFile
and installDir
. This values could be set using simple cache variables, using cacheVariables
entries (strictly CMAKE_TOOLCHAIN_FILE
and CMAKE_INSTALL_PREFIX
).
There is only a mention about toolchainFile
in documentation, that states:
This field takes precedence over any CMAKE_TOOLCHAIN_FILE value.
This does not resolves my confusion. The question is: Which method should I use and what is the difference?
The docs explain the difference:
The cache variable is expected to be an absolute path (typically computed from
${sourceDir}
).You should probably use the more specific option. It's a bit clearer and marginally less typing. Not a huge deal either way.