FindJNITarget.cmake 999 B

123456789101112131415161718192021222324252627282930313233
  1. if(JNITarget_FIND_QUIETLY)
  2. find_package(JNI QUIET)
  3. elseif(JNITarget_FIND_REQUIRED)
  4. find_package(JNI REQUIRED)
  5. else()
  6. find_package(JNI)
  7. endif()
  8. set(JNI_TARGET_INCLUDE_DIRS ${JNI_INCLUDE_DIRS})
  9. set(JNI_TARGET_LIBRARIES ${JNI_LIBRARIES})
  10. if (JNI_FOUND)
  11. add_library(JNITarget::jni IMPORTED UNKNOWN)
  12. set_property(TARGET JNITarget::jni PROPERTY
  13. IMPORTED_LOCATION ${JAVA_JVM_LIBRARY}
  14. )
  15. set_property(TARGET JNITarget::jni PROPERTY
  16. INTERFACE_INCLUDE_DIRECTORIES ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2}
  17. )
  18. add_library(JNITarget::jni_awt IMPORTED UNKNOWN)
  19. set_property(TARGET JNITarget::jni_awt PROPERTY
  20. IMPORTED_LOCATION ${JAVA_AWT_LIBRARY}
  21. )
  22. set_property(TARGET JNITarget::jni_awt PROPERTY
  23. INTERFACE_INCLUDE_DIRECTORIES ${JAVA_AWT_INCLUDE_PATH}
  24. )
  25. endif()
  26. include(FindPackageHandleStandardArgs)
  27. find_package_handle_standard_args(JNITarget DEFAULT_MSG JNI_TARGET_LIBRARIES JNI_TARGET_INCLUDE_DIRS)
  28. mark_as_advanced(JNI_TARGET_INCLUDE_DIRS JNI_TARGET_LIBRARIES)