# GENERATE\_NATIVE\_HEADERS target is not recognized as INTERFACE type

**URL:** https://discourse.cmake.org/t/generate-native-headers-target-is-not-recognized-as-interface-type/2048
**Category:** Usage
**Created:** [October 22, 2020, 10:01pm UTC](https://discourse.cmake.org/t/generate-native-headers-target-is-not-recognized-as-interface-type/2048 "2020-10-22T22:01:06Z")
**Posts on this page:** 1
**Showing post:** 7

<div class="post-metadata">

### Author: ![yisseamake](https://discourse.cmake.org/user_avatar/discourse.cmake.org/yisseamake/32/897_2.png) [@yisseamake](https://discourse.cmake.org/u/yisseamake)
#### Post date: [October 23, 2020, 6:54pm UTC](https://discourse.cmake.org/t/generate-native-headers-target-is-not-recognized-as-interface-type/2048/7 "2020-10-23T18:54:08Z")

</div>

If I drop myprojJNI from the list of targets in the install(TARGETS, then error occurs (below ) indicating that dependendee target myprojlibShared needs its dependency myprojJNI because they are linked by  
target\_link\_libraries(myprojlibShared  
…myprojJNI …)  
install(TARGETS myprojlibShared myprojJNI … #need myprojJNI bc it was linked  
EXPORT myExportTargets …  
)

ERROR: CMake Error: install(EXPORT “myExportTargets” …) includes target “myprojlibShared” which requires target “myprojJNI” that is not in any export set.

In regards to JNI not found (smaller problem), it got fixed after adding

```auto
set(CMAKE_FIND_ROOT_PATH "${JAVA_HOME}")
set(CMAKE_FIND_USE_CMAKE_SYSTEM_PATH "${JAVA_HOME}")

```

before find\_package(JNI)

The problem was caused by find\_package(JNI) search path considering only /opt/xxxx and /opt/toolchains while jni.h is located at /opt/jdk/jdk8/include/jni.h. Debugging was done with set(CMAKE\_FIND\_DEBUG\_MODE TRUE) enabling printout of /opt/cmake/share/cmake-3.17/Modules/FindJNI.cmake:341 looking for jni.h find\_path considered the following locations list

---

_[View the full topic](https://discourse.cmake.org/t/generate-native-headers-target-is-not-recognized-as-interface-type/2048)._
