Keep in mind that the CMake documentation is pretty clear that -D options must come before -P:
cmake [{-D <var>=<value>}...] -P <cmake-script-file>
Process the given cmake file as a script written in the CMake language. No configure or generate step is performed and the cache is not modified. If variables are defined using
-D
, this must be done before the-P
argument.
One could potentially mount a case that anything after the -P <cmake-script-file>
should be treated as arguments to the script and not processed at all. Given the existing behaviour of running the script as soon as the -P argument is processed, would we even need to use a --
option to separate the script args from the CMake args? The fact that the current behavior allows multiple -P invocations to be chained is something I’ve never seen and is not mentioned anywhere in the docs, as far as I can tell. I doubt this is something that we should try to preserve, but Brad can make that call.