# CMake 3.18 - Feature suggestion: New option for install(CODE ...)

**URL:** https://discourse.cmake.org/t/cmake-3-18-feature-suggestion-new-option-for-install-code/1756
**Category:** Development
**Created:** [August 28, 2020, 5:03pm UTC](https://discourse.cmake.org/t/cmake-3-18-feature-suggestion-new-option-for-install-code/1756 "2020-08-28T17:03:32Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Aymeric\_Pelle](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/a/76d3ee/32.png) [@Aymeric\_Pelle](https://discourse.cmake.org/u/Aymeric_Pelle)
#### Post date: [August 28, 2020, 5:03pm UTC](https://discourse.cmake.org/t/cmake-3-18-feature-suggestion-new-option-for-install-code/1756/1 "2020-08-28T17:03:32Z")

</div>

Hello,

I would like to install code at the beginning of the cmake\_install.cmake script.  
But, to do that an option BEFORE or PREPEND which indicated that the code should be put at the beginning of the install script is necessary.  
Do you think it would be possible to have such an option for install(CODE …)?

Thank you in advance for your reply.

Best regards,

Aymeric Pellé

---

<div class="post-metadata">

### Author: ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)
#### Post date: [August 28, 2020, 5:46pm UTC](https://discourse.cmake.org/t/cmake-3-18-feature-suggestion-new-option-for-install-code/1756/2 "2020-08-28T17:46:18Z")

</div>

Are you saying that your install scripts has dependencies which require one command to be executed before another?

Is it possible to handle this dependency before installation, during configuration or build?

---

<div class="post-metadata">

### Author: ![kyle.edwards](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/k/65b543/32.png) [@kyle.edwards](https://discourse.cmake.org/u/kyle.edwards)
#### Post date: [August 28, 2020, 5:53pm UTC](https://discourse.cmake.org/t/cmake-3-18-feature-suggestion-new-option-for-install-code/1756/3 "2020-08-28T17:53:12Z")

</div>

If you need your `install(CODE)` to run earlier, move it before other `install()` commands. For example, instead of:

```cmake
install(TARGETS foo DESTINATION bin)
install(CODE "# Code here")

```

do:

```cmake
install(CODE "# Code here")
install(TARGETS foo DESTINATION bin)

```
