Is there any analogy
install(CODE ...) # this code is executing AFTER install step
for pre-install step in cmake?
I suppose code execution in POST_BUILD step, but how to run this code?
Actually, install(CODE) and install(SCRIPT) are executed in the order in which they appear among other install() commands, so if your call to install(CODE) is the first install() call, it will be executed before all other installation commands.
Note that the ordering mentioned above (install() commands executed in order of appearance) applies for commands within one install component and one CMakeList file (thanks to @John for pointing this out in comments) . Nevertheless, for the intended "pre-install" step, putting the command on the first place in the first CMakeList should still work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With