[cmake-developers] FindJava, FindJNI on Mac

Larry Shaffer larrys at dakotacarto.com
Mon Feb 3 15:01:17 EST 2014


Hi,

This is a followup to this issue [0] and this pull request [1], relating to
finding Java and JNI on Mac.

After the commits noted here [2], I have found several issues:

* FindJava.cmake *

CMAKE_FIND_FRAMEWORK=FIRST|ONLY is ignored; only finds framework's
executable if JAVA_HOME is defined.

* FindJNI.cmake *

Defining a framework path for JAVA_HOME fails to find anything
  patch: https://gist.github.com/dakcarto/8789774

That patch just sniffs whether the defined framework is an Apple install,
i.e. has a 'bundle' symlink. I added a pattern match for '.framework', but
don't know if that is a proper solution for other platforms that utilize
frameworks, though.

When framework is preferred or defined, module now returns:

    JNI_LIBRARIES=
/System/Library/Frameworks/JavaVM.framework;/System/Library/Frameworks/JavaVM.framework
    JAVA_AWT_LIBRARY= /System/Library/Frameworks/JavaVM.framework
    JAVA_JVM_LIBRARY= /System/Library/Frameworks/JavaVM.framework

previously this was:

    JNI_LIBRARIES= -framework JavaVM;-framework JavaVM
    JAVA_AWT_LIBRARY= -framework JavaVM
    JAVA_JVM_LIBRARY= -framework JavaVM

Does this matter for frameworks? Seems like it should continue returning
the previous LDFLAGS results.

CMakeLists.txt for testing both modules (contains custom CMAKE_MODULE_PATH):
https://gist.github.com/dakcarto/8329063

[0] http://www.cmake.org/Bug/view.php?id=14689
[1] https://github.com/Kitware/CMake/pull/80
[2] https://github.com/Kitware/CMake/pull/80#issuecomment-33621209

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20140203/a542fe92/attachment.html>


More information about the cmake-developers mailing list