如何在cmake上使用FIND_JNI [英] How to use FIND_JNI on cmake

查看:222
本文介绍了如何在cmake上使用FIND_JNI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我的项目编写一个构建,以替换自动构建,并且需要正确使用FIND_JNI。

I'm trying to write a build for my project where I'm trying to replace autobuild, and I need to proper use FIND_JNI.

我可以制作一个简单的构建,但是找不到正确的jni.h

I could make a simple build but it's not properly finding jni.h

而且我需要找到一种正确的方法(没有技巧)来定义Java包含,因为这需要可移植到其他用户。

And I need to find a proper way (without a hack) to define the Java include as this needs to be portable to other users.

推荐答案

以下代码对我有用。在您的根 CMakeLists.txt 文件中,添加:

The following code works for me. In your root CMakeLists.txt file add:

find_package(JNI)

if (JNI_FOUND)
    message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}")
    message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}")
endif()

这篇关于如何在cmake上使用FIND_JNI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆