#1136021 cmake-data: add_jar() from the module UseJava does not define the SOURCES property.

#1136021#5
Date:
2026-05-08 14:19:36 UTC
From:
To:
Dear Maintainer,

When one defines a target with the built-in command add_executable() or add_library(), a target property named SOURCES that lists the related source files, is defined. The add_jar() command does not define it.

There is a simple workaround: use ->set_property(TARGET <jar target name> PROPERTY SOURCES "${Java_src}")<- with the same list of filenames used in the SOURCES argument of add_jar command. The fix is doing that directly in the add_jar command.
(Or perhaps with the similar command target_sources().)

I discovered this when I tried to make a real source package, as Automake does, by enumerating the defined targets and theirs respective source files.