title: Execute process at install stage, every time
body: <p>I would like to run program to perform do extra installation tasks from CMake. My attempted solution, based on <a href="https://cmake.org/cmake/help/v3.12/command/install.html#code" rel="nofollow noreferrer">INSTALL(CODE ...)</a> is (this is a real MWE):</p>
  
  <pre><code>macro(MY_EXTRA_STUFF ARG)
      execute_process(...)
  endmacro()
  install(CODE "MY_EXTRA_STUFF(${SOME_ARG})")
  </code></pre>
  
  <p>but CMake complains when I run <code>ninja install</code> (or <code>make install</code>, depending on generator in use):</p>
  
  <pre><code>[0/1] Install the project...
  -- Install configuration: ""
  CMake Error at cmake_install.cmake:41 (MY_EXTRA_STUFF):
    Unknown CMake command "MY_EXTRA_STUFF".
  
  
  FAILED: CMakeFiles/install.util 
  cd /tmp &amp;&amp; /usr/bin/cmake -P cmake_install.cmake
  ninja: build stopped: subcommand failed.
  </code></pre>
  
  <p>Is there a way to smuggle my own code into the install stage? The code is too long to fit inside <code>install(CODE "...")</code> nicely. A bonus to do it without an external file. Thanks!</p>