Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试为我尝试替换自动构建的项目编写构建,并且我需要正确使用 FIND_JNI。
我可以进行简单的构建,但无法正确找到 jni.h
而且我需要找到一种正确的方法(无需破解)来定义 Java 包含,因为它需要可移植给其他用户。
以下代码适用于我。在你的根CMakeLists.txt文件中添加:
CMakeLists.txt
find_package(JNI) if (JNI_FOUND) message (STATUS "JNI_INCLUDE_DIRS=${JNI_INCLUDE_DIRS}") message (STATUS "JNI_LIBRARIES=${JNI_LIBRARIES}") endif()