When running the first half of the script I shared previously, you’ll see that install
is listed as one of the commands. That’s because all commands that are “available only in CMake projects” are actually always defined, even in script mode. This allows CMake to fail with the following error message when calling them
<command> command is not scriptable
instead of the generic
Unknown CMake command "<command>".
The easiest way to know which commands are really available in script mode is to look at the documentation here: https://cmake.org/cmake/help/latest/manual/cmake-commands.7.html#scripting-commands