CPack (rpm) prebuild jar file changes checksum

I would like to generate a rpm package using cpack.
I’m using install(DIRECTORY … DESTINATION …) to also install a bunch of prebuild jar files.
But after rpm generation the packed jar files got modified and don’t have the same checksum as the original prebuild ones.

This is a problem, because later on I’m checking the checksums of the jar files.

Changing the files from .jar to e.g. .jar.bak and installing them will prevent the modification.

install(FILES … DESTINATION …) has the same behaviour.

Am I missing something?

Tested with latest version cmake-3.29.6-linux-x86_64

Edit:
I tested it with a lot of other file extensions and only jar seems to be affected.

@brad.king
Is this an intended behavior of cpack?
Is it a kind of compression of the jar files (if yes, how to prevent it)?

Sorry for bumping this again.

I have also created a ticket at gitlab:

CPack changes checksum of prebuild jar files (#26183) · Tickets · CMake / CMake · GitLab (kitware.com)

Could I get a validiation, if this is also happening for someone else?

@brad.king @craig.scott
Is this an intended behavior of cpack?
Or is this a error on my side?

Sorry, I have no insights into what’s happening in your scenario.

CPack RPM may not be the culprit here.
CPack RPM is using rpmbuild command to build RPM, rpmbuild may do some “jar repacking” which implies the checksum change.

See e.g.:
https://bugzilla.redhat.com/show_bug.cgi?id=219731

You can try to disable this by adding:
set(CPACK_RPM_SPEC_MORE_DEFINE "%define __jar_repack %{nil}")

to your CMakeLists.txt

Thank you very much, this was the part I was missing. Now I don’t have a checksum missmatch anymore.
Excuse my lack of knowlege here, was relativly new to rpm packaging.

Issure can be closed.