2016-09-27 19:01:08 +00:00
|
|
|
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
|
|
|
# file Copyright.txt or https://cmake.org/licensing for details.
|
|
|
|
|
2013-10-15 15:17:36 +00:00
|
|
|
#.rst:
|
|
|
|
# FindJNI
|
|
|
|
# -------
|
|
|
|
#
|
|
|
|
# Find JNI java libraries.
|
|
|
|
#
|
2001-05-04 13:47:58 +00:00
|
|
|
# This module finds if Java is installed and determines where the
|
2013-10-15 15:17:36 +00:00
|
|
|
# include files and libraries are. It also determines what the name of
|
2014-01-29 18:47:51 +00:00
|
|
|
# the library is. The caller may set variable JAVA_HOME to specify a
|
|
|
|
# Java installation prefix explicitly.
|
|
|
|
#
|
|
|
|
# This module sets the following result variables:
|
2012-08-13 17:42:58 +00:00
|
|
|
#
|
2013-10-15 15:17:36 +00:00
|
|
|
# ::
|
2008-07-20 19:39:02 +00:00
|
|
|
#
|
2013-10-15 15:17:36 +00:00
|
|
|
# JNI_INCLUDE_DIRS = the include dirs to use
|
|
|
|
# JNI_LIBRARIES = the libraries to use
|
|
|
|
# JNI_FOUND = TRUE if JNI headers and libraries were found.
|
|
|
|
# JAVA_AWT_LIBRARY = the path to the jawt library
|
|
|
|
# JAVA_JVM_LIBRARY = the path to the jvm library
|
|
|
|
# JAVA_INCLUDE_PATH = the include path to jni.h
|
|
|
|
# JAVA_INCLUDE_PATH2 = the include path to jni_md.h
|
|
|
|
# JAVA_AWT_INCLUDE_PATH = the include path to jawt.h
|
2008-07-20 19:39:02 +00:00
|
|
|
|
2009-09-30 18:15:23 +00:00
|
|
|
# Expand {libarch} occurences to java_libarch subdirectory(-ies) and set ${_var}
|
2012-08-13 17:47:32 +00:00
|
|
|
macro(java_append_library_directories _var)
|
2009-09-30 13:59:00 +00:00
|
|
|
# Determine java arch-specific library subdir
|
2010-07-30 08:19:42 +00:00
|
|
|
# Mostly based on openjdk/jdk/make/common/shared/Platform.gmk as of openjdk
|
|
|
|
# 1.6.0_18 + icedtea patches. However, it would be much better to base the
|
|
|
|
# guess on the first part of the GNU config.guess platform triplet.
|
2012-08-13 17:47:32 +00:00
|
|
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
|
2015-08-24 14:53:00 +00:00
|
|
|
if(CMAKE_LIBRARY_ARCHITECTURE STREQUAL "x86_64-linux-gnux32")
|
|
|
|
set(_java_libarch "x32" "amd64" "i386")
|
|
|
|
else()
|
2013-11-04 13:55:02 +00:00
|
|
|
set(_java_libarch "amd64" "i386")
|
2015-08-24 14:53:00 +00:00
|
|
|
endif()
|
2012-08-13 17:47:32 +00:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^i.86$")
|
|
|
|
set(_java_libarch "i386")
|
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^alpha")
|
|
|
|
set(_java_libarch "alpha")
|
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm")
|
2010-07-30 08:19:42 +00:00
|
|
|
# Subdir is "arm" for both big-endian (arm) and little-endian (armel).
|
2016-09-27 03:32:24 +00:00
|
|
|
set(_java_libarch "arm" "aarch32")
|
2012-08-13 17:47:32 +00:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips")
|
2010-07-30 08:19:42 +00:00
|
|
|
# mips* machines are bi-endian mostly so processor does not tell
|
|
|
|
# endianess of the underlying system.
|
2015-08-28 13:37:06 +00:00
|
|
|
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "mips" "mipsel" "mipseb" "mips64" "mips64el" "mipsn32" "mipsn32el")
|
2014-02-18 00:08:55 +00:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le")
|
2014-06-30 16:29:20 +00:00
|
|
|
set(_java_libarch "ppc64" "ppc64le")
|
2012-08-13 17:47:32 +00:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64")
|
2013-11-04 13:55:02 +00:00
|
|
|
set(_java_libarch "ppc64" "ppc")
|
2012-08-13 17:47:32 +00:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)")
|
2015-12-03 11:37:26 +00:00
|
|
|
set(_java_libarch "ppc" "ppc64")
|
2012-08-13 17:47:32 +00:00
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sparc")
|
2010-07-30 08:19:42 +00:00
|
|
|
# Both flavours can run on the same processor
|
2012-08-13 17:47:32 +00:00
|
|
|
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "sparc" "sparcv9")
|
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(parisc|hppa)")
|
|
|
|
set(_java_libarch "parisc" "parisc64")
|
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^s390")
|
2010-07-30 08:19:42 +00:00
|
|
|
# s390 binaries can run on s390x machines
|
2012-08-13 17:47:32 +00:00
|
|
|
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}" "s390" "s390x")
|
|
|
|
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^sh")
|
|
|
|
set(_java_libarch "sh")
|
2012-08-13 17:50:14 +00:00
|
|
|
else()
|
2012-08-13 17:47:32 +00:00
|
|
|
set(_java_libarch "${CMAKE_SYSTEM_PROCESSOR}")
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
2010-07-30 08:19:42 +00:00
|
|
|
|
|
|
|
# Append default list architectures if CMAKE_SYSTEM_PROCESSOR was empty or
|
|
|
|
# system is non-Linux (where the code above has not been well tested)
|
2012-08-13 17:47:32 +00:00
|
|
|
if(NOT _java_libarch OR NOT (CMAKE_SYSTEM_NAME MATCHES "Linux"))
|
|
|
|
list(APPEND _java_libarch "i386" "amd64" "ppc")
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
2010-07-30 08:19:42 +00:00
|
|
|
|
|
|
|
# Sometimes ${CMAKE_SYSTEM_PROCESSOR} is added to the list to prefer
|
|
|
|
# current value to a hardcoded list. Remove possible duplicates.
|
2012-08-13 17:47:32 +00:00
|
|
|
list(REMOVE_DUPLICATES _java_libarch)
|
2009-09-30 13:59:00 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
foreach(_path ${ARGN})
|
|
|
|
if(_path MATCHES "{libarch}")
|
|
|
|
foreach(_libarch ${_java_libarch})
|
|
|
|
string(REPLACE "{libarch}" "${_libarch}" _newpath "${_path}")
|
2016-03-08 05:06:20 +00:00
|
|
|
if(EXISTS ${_newpath})
|
|
|
|
list(APPEND ${_var} "${_newpath}")
|
|
|
|
endif()
|
2012-08-13 17:50:14 +00:00
|
|
|
endforeach()
|
|
|
|
else()
|
2016-03-08 05:06:20 +00:00
|
|
|
if(EXISTS ${_path})
|
|
|
|
list(APPEND ${_var} "${_path}")
|
|
|
|
endif()
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endmacro()
|
2009-09-30 13:59:00 +00:00
|
|
|
|
2014-01-29 18:47:51 +00:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/CMakeFindJavaCommon.cmake)
|
2014-01-29 18:28:43 +00:00
|
|
|
|
2014-01-29 18:51:01 +00:00
|
|
|
# Save CMAKE_FIND_FRAMEWORK
|
|
|
|
if(DEFINED CMAKE_FIND_FRAMEWORK)
|
|
|
|
set(_JNI_CMAKE_FIND_FRAMEWORK ${CMAKE_FIND_FRAMEWORK})
|
|
|
|
else()
|
|
|
|
unset(_JNI_CMAKE_FIND_FRAMEWORK)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(_JAVA_HOME_EXPLICIT)
|
|
|
|
set(CMAKE_FIND_FRAMEWORK NEVER)
|
|
|
|
endif()
|
|
|
|
|
2014-01-29 18:28:43 +00:00
|
|
|
set(JAVA_AWT_LIBRARY_DIRECTORIES)
|
|
|
|
if(_JAVA_HOME)
|
|
|
|
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
|
|
|
|
${_JAVA_HOME}/jre/lib/{libarch}
|
|
|
|
${_JAVA_HOME}/jre/lib
|
2015-02-18 06:09:41 +00:00
|
|
|
${_JAVA_HOME}/lib/{libarch}
|
2014-01-29 18:28:43 +00:00
|
|
|
${_JAVA_HOME}/lib
|
|
|
|
${_JAVA_HOME}
|
|
|
|
)
|
|
|
|
endif()
|
2012-08-13 17:47:32 +00:00
|
|
|
get_filename_component(java_install_version
|
2007-12-17 22:22:51 +00:00
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit;CurrentVersion]" NAME)
|
2008-07-20 19:39:02 +00:00
|
|
|
|
2014-01-29 18:28:43 +00:00
|
|
|
list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES
|
2003-10-16 15:05:04 +00:00
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib"
|
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib"
|
2007-12-17 22:22:51 +00:00
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib"
|
2009-09-30 13:59:00 +00:00
|
|
|
)
|
|
|
|
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
|
2003-02-11 18:37:19 +00:00
|
|
|
/usr/lib
|
|
|
|
/usr/local/lib
|
2008-07-20 19:50:13 +00:00
|
|
|
/usr/lib/jvm/java/lib
|
2009-09-30 13:59:00 +00:00
|
|
|
/usr/lib/java/jre/lib/{libarch}
|
2011-06-15 17:18:14 +00:00
|
|
|
/usr/lib/jvm/jre/lib/{libarch}
|
2009-09-30 13:59:00 +00:00
|
|
|
/usr/local/lib/java/jre/lib/{libarch}
|
|
|
|
/usr/local/share/java/jre/lib/{libarch}
|
|
|
|
/usr/lib/j2sdk1.4-sun/jre/lib/{libarch}
|
|
|
|
/usr/lib/j2sdk1.5-sun/jre/lib/{libarch}
|
|
|
|
/opt/sun-jdk-1.5.0.04/jre/lib/{libarch}
|
|
|
|
/usr/lib/jvm/java-6-sun/jre/lib/{libarch}
|
|
|
|
/usr/lib/jvm/java-1.5.0-sun/jre/lib/{libarch}
|
|
|
|
/usr/lib/jvm/java-6-sun-1.6.0.00/jre/lib/{libarch} # can this one be removed according to #8821 ? Alex
|
2009-09-30 18:15:23 +00:00
|
|
|
/usr/lib/jvm/java-6-openjdk/jre/lib/{libarch}
|
2011-03-28 15:39:27 +00:00
|
|
|
/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/{libarch} # fedora
|
2009-09-30 13:59:00 +00:00
|
|
|
# Debian specific paths for default JVM
|
|
|
|
/usr/lib/jvm/default-java/jre/lib/{libarch}
|
|
|
|
/usr/lib/jvm/default-java/jre/lib
|
|
|
|
/usr/lib/jvm/default-java/lib
|
2016-07-03 18:58:28 +00:00
|
|
|
# Ubuntu specific paths for default JVM
|
|
|
|
/usr/lib/jvm/java-8-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
|
|
|
|
/usr/lib/jvm/java-7-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
|
|
|
|
/usr/lib/jvm/java-6-openjdk-{libarch}/jre/lib/{libarch} # Ubuntu 15.10
|
2012-12-03 23:23:10 +00:00
|
|
|
# OpenBSD specific paths for default JVM
|
|
|
|
/usr/local/jdk-1.7.0/jre/lib/{libarch}
|
|
|
|
/usr/local/jre-1.7.0/lib/{libarch}
|
|
|
|
/usr/local/jdk-1.6.0/jre/lib/{libarch}
|
|
|
|
/usr/local/jre-1.6.0/lib/{libarch}
|
2015-08-25 07:31:30 +00:00
|
|
|
# SuSE specific paths for default JVM
|
|
|
|
/usr/lib64/jvm/java/jre/lib/{libarch}
|
|
|
|
/usr/lib64/jvm/jre/lib/{libarch}
|
2003-02-11 18:37:19 +00:00
|
|
|
)
|
2008-07-20 19:39:02 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
set(JAVA_JVM_LIBRARY_DIRECTORIES)
|
|
|
|
foreach(dir ${JAVA_AWT_LIBRARY_DIRECTORIES})
|
2014-01-29 18:28:43 +00:00
|
|
|
list(APPEND JAVA_JVM_LIBRARY_DIRECTORIES
|
2006-10-27 21:29:05 +00:00
|
|
|
"${dir}"
|
|
|
|
"${dir}/client"
|
|
|
|
"${dir}/server"
|
2015-08-25 07:31:30 +00:00
|
|
|
# IBM SDK, Java Technology Edition, specific paths
|
|
|
|
"${dir}/j9vm"
|
|
|
|
"${dir}/default"
|
2006-10-27 21:29:05 +00:00
|
|
|
)
|
2012-08-13 17:50:14 +00:00
|
|
|
endforeach()
|
2006-10-27 21:29:05 +00:00
|
|
|
|
2014-01-29 18:28:43 +00:00
|
|
|
set(JAVA_AWT_INCLUDE_DIRECTORIES)
|
|
|
|
if(_JAVA_HOME)
|
|
|
|
list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES ${_JAVA_HOME}/include)
|
|
|
|
endif()
|
|
|
|
list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES
|
2003-10-16 15:05:04 +00:00
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include"
|
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
|
2007-12-17 22:22:51 +00:00
|
|
|
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include"
|
2016-03-08 05:02:49 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_INCLUDE_DIRECTORIES
|
2012-08-13 17:42:58 +00:00
|
|
|
/usr/include
|
2001-06-06 13:43:54 +00:00
|
|
|
/usr/local/include
|
2002-06-17 17:43:21 +00:00
|
|
|
/usr/lib/java/include
|
2002-07-15 13:22:17 +00:00
|
|
|
/usr/local/lib/java/include
|
2008-07-20 19:50:13 +00:00
|
|
|
/usr/lib/jvm/java/include
|
2009-04-21 21:12:32 +00:00
|
|
|
/usr/lib/jvm/java-6-sun/include
|
|
|
|
/usr/lib/jvm/java-1.5.0-sun/include
|
|
|
|
/usr/lib/jvm/java-6-sun-1.6.0.00/include # can this one be removed according to #8821 ? Alex
|
2009-09-30 18:15:23 +00:00
|
|
|
/usr/lib/jvm/java-6-openjdk/include
|
2016-03-08 05:02:49 +00:00
|
|
|
/usr/lib/jvm/java-8-openjdk-{libarch}/include # ubuntu 15.10
|
|
|
|
/usr/lib/jvm/java-7-openjdk-{libarch}/include # ubuntu 15.10
|
|
|
|
/usr/lib/jvm/java-6-openjdk-{libarch}/include # ubuntu 15.10
|
2006-10-12 17:12:37 +00:00
|
|
|
/usr/local/share/java/include
|
2005-02-10 03:46:33 +00:00
|
|
|
/usr/lib/j2sdk1.4-sun/include
|
2005-09-08 14:03:51 +00:00
|
|
|
/usr/lib/j2sdk1.5-sun/include
|
2005-09-23 18:38:51 +00:00
|
|
|
/opt/sun-jdk-1.5.0.04/include
|
2009-09-30 18:15:23 +00:00
|
|
|
# Debian specific path for default JVM
|
|
|
|
/usr/lib/jvm/default-java/include
|
2012-12-03 23:23:10 +00:00
|
|
|
# OpenBSD specific path for default JVM
|
|
|
|
/usr/local/jdk-1.7.0/include
|
|
|
|
/usr/local/jdk-1.6.0/include
|
2015-08-25 07:31:30 +00:00
|
|
|
# SuSE specific paths for default JVM
|
|
|
|
/usr/lib64/jvm/java/include
|
2003-02-11 18:37:19 +00:00
|
|
|
)
|
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
|
|
|
|
get_filename_component(jpath "${JAVA_PROG}" PATH)
|
|
|
|
foreach(JAVA_INC_PATH ../include ../java/include ../share/java/include)
|
|
|
|
if(EXISTS ${jpath}/${JAVA_INC_PATH})
|
2014-01-29 18:28:43 +00:00
|
|
|
list(APPEND JAVA_AWT_INCLUDE_DIRECTORIES "${jpath}/${JAVA_INC_PATH}")
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
|
|
|
endforeach()
|
2012-08-13 17:47:32 +00:00
|
|
|
foreach(JAVA_LIB_PATH
|
2012-08-13 17:42:58 +00:00
|
|
|
../lib ../jre/lib ../jre/lib/i386
|
|
|
|
../java/lib ../java/jre/lib ../java/jre/lib/i386
|
2004-02-06 15:49:46 +00:00
|
|
|
../share/java/lib ../share/java/jre/lib ../share/java/jre/lib/i386)
|
2012-08-13 17:47:32 +00:00
|
|
|
if(EXISTS ${jpath}/${JAVA_LIB_PATH})
|
2014-01-29 18:28:43 +00:00
|
|
|
list(APPEND JAVA_AWT_LIBRARY_DIRECTORIES "${jpath}/${JAVA_LIB_PATH}")
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endforeach()
|
2004-02-06 15:49:46 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
if(APPLE)
|
2014-01-29 18:51:01 +00:00
|
|
|
if(CMAKE_FIND_FRAMEWORK STREQUAL "ONLY")
|
|
|
|
set(_JNI_SEARCHES FRAMEWORK)
|
|
|
|
elseif(CMAKE_FIND_FRAMEWORK STREQUAL "NEVER")
|
|
|
|
set(_JNI_SEARCHES NORMAL)
|
|
|
|
elseif(CMAKE_FIND_FRAMEWORK STREQUAL "LAST")
|
|
|
|
set(_JNI_SEARCHES NORMAL FRAMEWORK)
|
|
|
|
else()
|
|
|
|
set(_JNI_SEARCHES FRAMEWORK NORMAL)
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
2014-01-29 18:51:01 +00:00
|
|
|
set(_JNI_FRAMEWORK_JVM NAMES JavaVM)
|
|
|
|
set(_JNI_FRAMEWORK_JAWT "${_JNI_FRAMEWORK_JVM}")
|
|
|
|
else()
|
|
|
|
set(_JNI_SEARCHES NORMAL)
|
|
|
|
endif()
|
2007-04-04 17:43:12 +00:00
|
|
|
|
2014-01-29 18:51:01 +00:00
|
|
|
set(_JNI_NORMAL_JVM
|
|
|
|
NAMES jvm
|
|
|
|
PATHS ${JAVA_JVM_LIBRARY_DIRECTORIES}
|
|
|
|
)
|
2007-04-04 17:43:12 +00:00
|
|
|
|
2014-01-29 18:51:01 +00:00
|
|
|
set(_JNI_NORMAL_JAWT
|
|
|
|
NAMES jawt
|
|
|
|
PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
|
|
|
|
)
|
2007-04-04 17:43:12 +00:00
|
|
|
|
2014-01-29 18:51:01 +00:00
|
|
|
foreach(search ${_JNI_SEARCHES})
|
|
|
|
find_library(JAVA_JVM_LIBRARY ${_JNI_${search}_JVM})
|
|
|
|
find_library(JAVA_AWT_LIBRARY ${_JNI_${search}_JAWT})
|
|
|
|
if(JAVA_JVM_LIBRARY)
|
|
|
|
break()
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
2014-01-29 18:51:01 +00:00
|
|
|
endforeach()
|
|
|
|
unset(_JNI_SEARCHES)
|
|
|
|
unset(_JNI_FRAMEWORK_JVM)
|
|
|
|
unset(_JNI_FRAMEWORK_JAWT)
|
|
|
|
unset(_JNI_NORMAL_JVM)
|
|
|
|
unset(_JNI_NORMAL_JAWT)
|
|
|
|
|
|
|
|
# Find headers matching the library.
|
|
|
|
if("${JAVA_JVM_LIBRARY};${JAVA_AWT_LIBRARY};" MATCHES "(/JavaVM.framework|-framework JavaVM);")
|
|
|
|
set(CMAKE_FIND_FRAMEWORK ONLY)
|
2012-08-13 17:50:14 +00:00
|
|
|
else()
|
2014-01-29 18:51:01 +00:00
|
|
|
set(CMAKE_FIND_FRAMEWORK NEVER)
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
2003-02-11 18:37:19 +00:00
|
|
|
|
2012-08-13 17:42:58 +00:00
|
|
|
# add in the include path
|
2012-08-13 17:47:32 +00:00
|
|
|
find_path(JAVA_INCLUDE_PATH jni.h
|
2003-02-11 18:37:19 +00:00
|
|
|
${JAVA_AWT_INCLUDE_DIRECTORIES}
|
2001-06-06 13:43:54 +00:00
|
|
|
)
|
|
|
|
|
2015-12-03 11:37:26 +00:00
|
|
|
find_path(JAVA_INCLUDE_PATH2 NAMES jni_md.h jniport.h
|
|
|
|
PATHS
|
2009-10-29 17:48:32 +00:00
|
|
|
${JAVA_INCLUDE_PATH}
|
2014-01-09 14:59:35 +00:00
|
|
|
${JAVA_INCLUDE_PATH}/darwin
|
2001-05-04 14:13:37 +00:00
|
|
|
${JAVA_INCLUDE_PATH}/win32
|
|
|
|
${JAVA_INCLUDE_PATH}/linux
|
2008-07-20 19:45:49 +00:00
|
|
|
${JAVA_INCLUDE_PATH}/freebsd
|
2012-12-03 23:23:10 +00:00
|
|
|
${JAVA_INCLUDE_PATH}/openbsd
|
2009-11-02 09:03:06 +00:00
|
|
|
${JAVA_INCLUDE_PATH}/solaris
|
2011-03-28 15:57:04 +00:00
|
|
|
${JAVA_INCLUDE_PATH}/hp-ux
|
|
|
|
${JAVA_INCLUDE_PATH}/alpha
|
2015-12-03 11:37:26 +00:00
|
|
|
${JAVA_INCLUDE_PATH}/aix
|
2001-05-04 14:13:37 +00:00
|
|
|
)
|
2001-06-06 13:43:54 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
find_path(JAVA_AWT_INCLUDE_PATH jawt.h
|
2007-04-04 17:43:12 +00:00
|
|
|
${JAVA_INCLUDE_PATH}
|
|
|
|
)
|
2001-12-20 02:51:39 +00:00
|
|
|
|
2014-01-29 18:51:01 +00:00
|
|
|
# Restore CMAKE_FIND_FRAMEWORK
|
|
|
|
if(DEFINED _JNI_CMAKE_FIND_FRAMEWORK)
|
|
|
|
set(CMAKE_FIND_FRAMEWORK ${_JNI_CMAKE_FIND_FRAMEWORK})
|
|
|
|
unset(_JNI_CMAKE_FIND_FRAMEWORK)
|
|
|
|
else()
|
|
|
|
unset(CMAKE_FIND_FRAMEWORK)
|
|
|
|
endif()
|
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
|
2016-07-03 20:34:43 +00:00
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(JNI DEFAULT_MSG JAVA_AWT_LIBRARY
|
|
|
|
JAVA_JVM_LIBRARY
|
|
|
|
JAVA_INCLUDE_PATH
|
|
|
|
JAVA_INCLUDE_PATH2
|
|
|
|
JAVA_AWT_INCLUDE_PATH)
|
2009-12-21 20:56:05 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
mark_as_advanced(
|
2001-12-20 02:51:39 +00:00
|
|
|
JAVA_AWT_LIBRARY
|
2006-10-27 21:30:26 +00:00
|
|
|
JAVA_JVM_LIBRARY
|
2001-12-20 02:51:39 +00:00
|
|
|
JAVA_AWT_INCLUDE_PATH
|
|
|
|
JAVA_INCLUDE_PATH
|
|
|
|
JAVA_INCLUDE_PATH2
|
|
|
|
)
|
2008-07-20 19:39:02 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
set(JNI_LIBRARIES
|
2008-07-20 19:39:02 +00:00
|
|
|
${JAVA_AWT_LIBRARY}
|
|
|
|
${JAVA_JVM_LIBRARY}
|
|
|
|
)
|
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
set(JNI_INCLUDE_DIRS
|
2008-07-20 19:39:02 +00:00
|
|
|
${JAVA_INCLUDE_PATH}
|
|
|
|
${JAVA_INCLUDE_PATH2}
|
|
|
|
${JAVA_AWT_INCLUDE_PATH}
|
|
|
|
)
|
|
|
|
|