参考示例https://github.com/ice1000/algo4j/blob/master/jni/CMakeLists.txt
如果需要在cmake中添加对jni的编译支持,必须包含以下几项:
project(myproject)
find_package(Java REQUIRED)
find_package(JNI REQUIRED)
if (JNI_FOUND)
message(STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
message(STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
endif ()
include_directories(${JNI_INCLUDE_DIRS})
其中project(myproject)的定义必不可少,否则后续的find_package会失败
网友评论