CMake/Modules/FindJNI.cmake

78 lines
2.6 KiB
CMake
Raw Normal View History

2001-05-04 17:47:58 +04:00
#
# This module finds if Java is installed and determines where the
# include files and libraries are. It also determines what the name of
# the library is. This code sets the following variables:
#
# JAVA_AWT_LIB_PATH = the path to where the jawt library is
# JAVA_INCLUDE_PATH = the path to where jni.h can be found
# JAVA_AWT_INCLUDE_PATH = the path to where jni.h can be found
#
2001-12-20 05:51:39 +03:00
SET(JAVA_AWT_LIBRARY_DIRECTORIES
/usr/lib
/usr/local/lib
/usr/lib/java/jre/lib/i386
/usr/local/lib/java/jre/lib/i386
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib"
)
2001-05-04 17:47:58 +04:00
SET(JAVA_AWT_INCLUDE_DIRECTORIES
2001-06-06 17:43:54 +04:00
/usr/include
/usr/local/include
2002-06-17 21:43:21 +04:00
/usr/lib/java/include
/usr/local/lib/java/include
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
)
IF(APPLE)
IF(EXISTS ~/Library/Frameworks/JavaEmbedding.framework)
SET(JAVA_HAVE_FRAMEWORK 1)
ENDIF(EXISTS ~/Library/Frameworks/JavaEmbedding.framework)
IF(EXISTS /Library/Frameworks/JavaEmbedding.framework)
SET(JAVA_HAVE_FRAMEWORK 1)
ENDIF(EXISTS /Library/Frameworks/JavaEmbedding.framework)
2003-02-11 21:53:30 +03:00
IF(EXISTS /System/Library/Frameworks/JavaEmbedding.framework)
SET(JAVA_HAVE_FRAMEWORK 1)
ENDIF(EXISTS /System/Library/Frameworks/JavaEmbedding.framework)
IF(JAVA_HAVE_FRAMEWORK)
2003-02-11 21:56:35 +03:00
IF(NOT JAVA_AWT_LIBRARY)
SET (JAVA_AWT_LIBRARY "-framework JavaVM -framework JavaEmbedding" CACHE FILEPATH "Java Frameworks" FORCE)
ENDIF(NOT JAVA_AWT_LIBRARY)
2003-02-11 22:49:11 +03:00
SET(JAVA_AWT_INCLUDE_DIRECTORIES ${JAVA_AWT_INCLUDE_DIRECTORIES}
~/Library/Frameworks/JavaVM.framework/Headers
/Library/Frameworks/JavaVM.framework/Headers
/System/Library/Frameworks/JavaVM.framework/Headers
~/Library/Frameworks/JavaEmbedding.framework/Headers
/Library/Frameworks/JavaEmbedding.framework/Headers
/System/Library/Frameworks/JavaEmbedding.framework/Headers
)
ENDIF(JAVA_HAVE_FRAMEWORK)
2003-02-11 22:49:11 +03:00
ELSE(APPLE)
FIND_LIBRARY(JAVA_AWT_LIBRARY jawt
PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
)
ENDIF(APPLE)
# add in the include path
FIND_PATH(JAVA_INCLUDE_PATH jni.h
${JAVA_AWT_INCLUDE_DIRECTORIES}
2001-06-06 17:43:54 +04:00
)
2001-05-04 18:13:37 +04:00
FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h
${JAVA_AWT_INCLUDE_DIRECTORIES}
2001-05-04 18:13:37 +04:00
${JAVA_INCLUDE_PATH}/win32
${JAVA_INCLUDE_PATH}/linux
)
2001-06-06 17:43:54 +04:00
2003-02-11 22:49:11 +03:00
FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h
${JAVA_AWT_INCLUDE_DIRECTORIES} ${JAVA_INCLUDE_PATH} )
2001-12-20 05:51:39 +03:00
MARK_AS_ADVANCED(
JAVA_AWT_LIBRARY
JAVA_AWT_INCLUDE_PATH
JAVA_INCLUDE_PATH
JAVA_INCLUDE_PATH2
)