# CPack/install oddity with "overridden" install directive

**URL:** https://discourse.cmake.org/t/cpack-install-oddity-with-overridden-install-directive/10349
**Category:** Code
**Tags:** os:linux, gen:ninja, cpack:deb
**Created:** [March 12, 2024, 6:56pm UTC](https://discourse.cmake.org/t/cpack-install-oddity-with-overridden-install-directive/10349 "2024-03-12T18:56:04Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![robiwano](https://discourse.cmake.org/user_avatar/discourse.cmake.org/robiwano/32/1027_2.png) [@robiwano](https://discourse.cmake.org/u/robiwano)
#### Post date: [March 12, 2024, 6:56pm UTC](https://discourse.cmake.org/t/cpack-install-oddity-with-overridden-install-directive/10349/1 "2024-03-12T18:56:04Z")

</div>

Hi,

I have a project where I generate a Debian package, and I have a default install directive for a logotype file:

```auto
install(FILES
    assets/logo.png
    DESTINATION www/assets
    COMPONENT Assets
)

```

Then, later on and optionally, I want to override that directive with:

```auto
# Overwrite default logo
install(FILES
    assets/logo.png <<<< Different from the one above!!!
    DESTINATION www/assets
    COMPONENT Assets
)

```

When I generate my package locally with `cpack -V -G DEB` I can see this (wrt to the later install directive) (WSL Ubuntu 22.04.3 LTS)

```auto
CPack Verbose: **Installing** : ..../_CPack_Packages/Linux/DEB/my_awesome_project/www/assets/logo.png

```

whereas when built on another machine (Ubuntu 18.04), I get this:

```auto
CPack Verbose: **Up-to-date** : ..../_CPack_Packages/Linux/DEB/my_awesome_project/www/assets/logo.png

```

As you can see, in the latter case, the default logo.png is not overwritten.

Both systems run CMake 3.28.3.

Basic question is: How can I make sure that the later install directive installs (or overwrites) the default one?? I would prefer not to have to remove the first install directive.

---

<div class="post-metadata">

### Author: ![robiwano](https://discourse.cmake.org/user_avatar/discourse.cmake.org/robiwano/32/1027_2.png) [@robiwano](https://discourse.cmake.org/u/robiwano)
#### Post date: [March 12, 2024, 7:45pm UTC](https://discourse.cmake.org/t/cpack-install-oddity-with-overridden-install-directive/10349/2 "2024-03-12T19:45:22Z")

</div>

Ok, so the difference is that when built on another machine, the sources are checked-out at the same time, making both PNG files having the same timestamp (roughly), making the second install directive “fail”.

So I basically ended up doing:

```auto
# Overwrite default logo
configure_file(assets/logo.png ${CMAKE_CURRENT_BINARY_DIR}/logo.png COPYONLY)
install(FILES
    ${CMAKE_CURRENT_BINARY_DIR}/logo.png
    DESTINATION www/assets
    COMPONENT Assets
)

```

where the configure\_file step is used to make sure the second source PNG is newer than the first one.
