Preset code
Is there any analogy
install(CODE ...) # this code is executing AFTER install step
for the pre-install step in cmake?
I am assuming the code is being executed during the POST_BUILD step, but how do I run this code?
Actually, install(CODE)
they install(SCRIPT)
are executed in the order in which they appear among other commands install()
, so if your call install(CODE)
is the first call install()
, it will be executed before all other installation commands.
Note that the above order ( install()
commands executed in order of appearance) applies to commands within one install component and one CMakeList file (thanks to @John for pointing this out in the comments). However, for the intended "pre-install" step, setting the command to the first position in the first CMakeList should work.