Skip to content

UseJava.cmake: Add namespace adjustment for resources

Smit-tay requested to merge Smit-tay/cmake:topic/jar_namespace into master

Current add_jar functionality requires relative paths for resources. This can be confusing with out of source builds, because the expected resource namespace will include the relative path to the source root which is probably not what is desired

example:

mkdir ../build && cd ../build
cmake ../src && make

resultant jar will contain: /src/path/to/resource

instead of expected: /path/to/resource

This patch allows the specification of a resource namespace, which is then applied to all resources (perhaps overly aggressively) The result of this patch is that ../src/path/to/ONE/resource1.txt and ../src/path/to/TWO/resource2.txt will both appear in the jar under: /new/namespace/path

(e.g. /new/namespace/path/resource1.txt
      /new/namespace/path/resource2.txt )

NOTE: NO test performed for matching base name in different source paths

Related: #22101 (closed)

Edited by Smit-tay

Merge request reports