CPack/install oddity with "overridden" install directive

Hi,

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

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

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

# 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)

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:

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.

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:

# 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.