summaryrefslogtreecommitdiffstats
path: root/Modules/FindJNI.cmake
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-02-11 18:37:19 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-02-11 18:37:19 (GMT)
commit8e105e0a9f8eeb097376eb4a25b96c5b8bae9d19 (patch)
tree2dcbc0fd2a326a73cd333706ccf25283f57ecc4f /Modules/FindJNI.cmake
parent0b494eaaa9c049e525d8360c44dc77fb25eb8152 (diff)
downloadCMake-8e105e0a9f8eeb097376eb4a25b96c5b8bae9d19.zip
CMake-8e105e0a9f8eeb097376eb4a25b96c5b8bae9d19.tar.gz
CMake-8e105e0a9f8eeb097376eb4a25b96c5b8bae9d19.tar.bz2
Improve searching for java files on OSX
Diffstat (limited to 'Modules/FindJNI.cmake')
-rw-r--r--Modules/FindJNI.cmake48
1 files changed, 38 insertions, 10 deletions
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 293de87..e90988d 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -8,26 +8,54 @@
# JAVA_AWT_INCLUDE_PATH = the path to where jni.h can be found
#
-FIND_LIBRARY(JAVA_AWT_LIBRARY jawt
- PATHS /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"
-)
+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"
+ )
-# add in the include path
-FIND_PATH(JAVA_INCLUDE_PATH jni.h
+SET(JAVA_AWT_INCLUDE_DIRECTORIES
/usr/include
/usr/local/include
/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"
+ )
+
+FIND_LIBRARY(JAVA_AWT_LIBRARY jawt
+ PATHS ${JAVA_AWT_LIBRARY_DIRECTORIES}
+)
+
+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)
+ IF(JAVA_HAVE_FRAMEWORK)
+ IF(NOT JAVA_LIBRARY)
+ SET (JAVA_LIBRARY "-framework JavaVM -framework JavaEmbedding" CACHE FILEPATH "Java Frameworks" FORCE)
+ SET(JAVA_AWT_INCLUDE_DIRECTORIES
+ ~/Library/Frameworks/JavaEmbedding.framework/Headers
+ /Library/Frameworks/JavaEmbedding.framework/Headers
+ /System/Library/Frameworks/JavaEmbedding.framework/Headers
+ )
+ ENDIF(NOT JAVA_LIBRARY)
+ ENDIF(JAVA_HAVE_FRAMEWORK)
+ENDIF(APPLE)
+
+# add in the include path
+FIND_PATH(JAVA_INCLUDE_PATH jni.h
+ ${JAVA_AWT_INCLUDE_DIRECTORIES}
)
FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h
+ ${JAVA_AWT_INCLUDE_DIRECTORIES}
${JAVA_INCLUDE_PATH}/win32
${JAVA_INCLUDE_PATH}/linux
)