# Including resources with add\_jar

**URL:** https://discourse.cmake.org/t/including-resources-with-add-jar/1583
**Category:** Usage
**Tags:** os:android
**Created:** [July 18, 2020, 6:03am UTC](https://discourse.cmake.org/t/including-resources-with-add-jar/1583 "2020-07-18T06:03:20Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Jacob\_Varghese](https://discourse.cmake.org/user_avatar/discourse.cmake.org/jacob_varghese/32/670_2.png) [@Jacob\_Varghese](https://discourse.cmake.org/u/Jacob_Varghese)
#### Post date: [July 18, 2020, 6:03am UTC](https://discourse.cmake.org/t/including-resources-with-add-jar/1583/1 "2020-07-18T06:03:20Z")

</div>

Hi I’m trying to include some resources (jni library files) inside my jar but I’m facing issues to get exactly what I want.

I use add\_jar(target SOURCES ${javasources} OUTPUT\_DIR ${BUILD\_ROOT}/jar) to generate the Jar and it works well).

But when I use,  
file(GLOB\_RECURSE jniResources ${STAGING\_ROOT}/\*\*.so)  
add\_jar(target SOURCES ${javasources} ${jniResources} OUTPUT\_DIR ${BUILD\_ROOT}/jar), it thinks the absolute paths are relative. When I point to the .so file directly in jniResources, it does copy it over but how it decides which folders are to be copied as well isn’t really clear to me and I’d like to copy over a specific folder and it’s contents starting from the specific folder.

---

<div class="post-metadata">

### Author: ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)
#### Post date: [July 18, 2020, 9:00am UTC](https://discourse.cmake.org/t/including-resources-with-add-jar/1583/2 "2020-07-18T09:00:41Z")

</div>

By looking at implementation, resources are assumed to be specified as relative paths to the current source directory (`CMAKE_CURRENT_SOURCE_DIR`).

You can use command `file(RELATIVE_PATH...)` to compute relative paths from your initial absolute paths.
